The underlying technology for JSF is Servlets. JSF framework provides a controlling Faces Servlet that must be configured in the file web.xml. Fortunately, can use same file for most JSF web applications.
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>faces/index.xhtml</welcome-file> </welcome-file-list> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> </web-app>
The servlet element specifies the class to be executed to run the Faces Servlet.
The servlet-mapping element insures that JSF page requests are processed by the controlling Servlet called the Faces Servlet.
Here are the events:
Browser requests http://daneel.d.umn.edu:29104/login/
This redirects to http://daneel.d.umn.edu:29104/login/faces/index.xhtml
The mapping servlet-mapping rule cause the web server to activate the Faces servlet, which is the entry point to the JSF implementation.
The Faces servlet loads the index.xhtml page.
When the user clicks Login the Faces servlet navigates to welcome.xhtml page.
The welcome-file element insures that index.xhtml is initially loaded.
The context-param element adds support for debugging.