The Java EE 6 Tutorial, Volume I

Mapping the Faces Servlet Instance

The final task requires mapping the Faces Servlet which is done through the web deployment descriptor (web.xml). A typical mapping of Faces Servlet is as follows:

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>

The above file segment represents part of a typical JavaServer Faces web deployment descriptor. The web deployment descriptor can also contain other content relevant to a JavaServer Faces application configuration but that information is not covered here.

Mapping the Faces Servlet is automatically done for you when using a Java EE 6server such as Sun GlassFishTM Enterprise Server v3.