The web application deployment descriptor conveys configuration information between application developers, deployers, and assemblers. Web containers also use the descriptor to configure and load web applications when the container is started.
All servlet containers that are compliant with the 2.3 Servlet specification are required to support the following types of deployment information:
Security configuration information is not required unless the servlet container is part of a J2EE implementation. The following elements are not required unless the servlet container is using JSP pages or is part of a J2EE application server:
4.4.1 Web Application Deployment Descriptor DTD
The format for both the web application deployment descriptor and the Struts configuration file is based on a Document Type Definition (DTD), which defines the legal building blocks that may be used in the XML files. From the DTD point of view, all XML documents, including the web application deployment descriptor and the Struts configuration file, are made up of the following elements:
Using these components, DTDs help to specify valid and well-formed XML documents. The DTD for the 2.3 web application deployment descriptor can be downloaded from http://java.sun.com/dtd/index.html.
The following DTD declaration shows the top-level elements that make up the deployment descriptor for a web application:
<!ELEMENT web-app (icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime- mapping*, welcome-file-list?, error-page*, taglib*, resource- env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*) >
The web-app element is the root of the deployment descriptor for a web application. The other elements inside the parentheses are child elements, which must be placed inside the root web-app element within the XML file. The symbols next to the child elements indicate the allowed multiplicity of the child elements within the XML file. Table 4-1 provides a brief explanation of the symbols.