Web Application Deployment Descriptor
The WEB-INF/web.xml file is the
Java web
application deployment descriptor that contains all general
configuration information for the application, in addition to the
JSF-specific information in the
WEB-INF/faces-config.xml file described in
Appendix E. Some elements are especially important for a JSF
application, namely the <context-param>,
<servlet>, and
<servlet-mapping> elements. See the
subsections for these elements for what configurations you must and
can set for a JSF-application in the
WEB-INF/web.xml file.
The deployment descriptor is an XML file. Starting with Servlet 2.4 and JSP 2.0, the elements it can contain and how they must be arranged are controlled by a number of XML Schema documents. The main XML Schema document, which includes the others, is available online at http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd. This XML Schema document must be referenced in the root element of the deployment description, as shown in Example F-1.
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4>
...
</web-app>If you’re not familiar with the intricate details of
XML Schema and namespace declarations, just accept the fact that you
must enclose all other elements in the deployment descriptor within a
<web-app> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access