Deployment Descriptor files

Web.xml is clearly a xml file that act as a medium between the developer and a web container. It is also called index of an app or Deployment Descriptor files.

Neither the directory not the name of web.xml can be change because it is set according to name to recognized by container at run-time.

In web.xml file, following things are configured :-

  • Servlet
  • JSP
  • Filter
  • Listeness
  • Welcome files
  • Security

Servlet file configuration requires following xml tags

  • <Servlet>
  • <Serlet-mapping>

To configure servlet <servlet>: tag are used. This tag contains servlet tag and container name.

<Serlet-mapping> are purposed to map servlet to a specific url.

Sun Microsystem has already define a structure for Web.xml files. So being a developer you will need to follow the structure and configuration of web resources are done according to it.

Three names requires to be added to configure a servlet in Web.xml file

  • Alias name or register name
  • Fully qualified class name
  • url-pattern


  • <web-app>
    <servlet-name>alias name</servlet-name>
    <servlet-class>fully qualified class name</servlet-class>
    <servlet-name>alias name</servlet-name>
    <url-pattern>/url pattern</url-pattern>