Java Web Applications web.xml Basic Fundamentals


Java Web Applications

      use a deployment descriptor file to determine how URLs map to servlets
      web.xml is the file is the deployment descriptor
      some URL’s require authentication
      resides in the WEB-INF folder
      describes the classes, resources and configuration of the application
      maps the URL of the request to the code that handles the request


    Below, the java class is mapped to the url’s here.

    <web-app xmlns="" version="2.5">


    Below, the web.xml defines key value pairs

    String teamColor = getServletConfig().getInitParameter("teamColor");


    JSP’s are servlets also :). That define static content mixed with Java code.


    A filter is a class that acts on a request like a servlet, but may allow the handling of the request to continue with other filters or servlets. A filter may perform an auxiliary task such as logging, performing specialized authentication checks, or annotating the request or response objects before calling the servlet.

    A filter implements javax.servlet.Filter, includes doFilter() method.

    Error Handlers