Java Reference
In-Depth Information
to start. See “
The Lifecycle of a JavaServer Faces Application
”
on page
50
for more in-
formation.
The following example shows the default configuration of the
FacesServlet
:
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-
class>
</servlet>
You provide a mapping configuration entry to make sure the
FacesServlet
instance is
invoked. The mapping to
FacesServlet
can be a prefix mapping, such as
/faces/*
,
or an extension mapping, such as
*.xhtml
. The mapping is used to identify a page as
having JavaServer Faces content. Because of this, the URL to the first page of the applic-
ation must include the URL pattern mapping.
The following elements, commonly used in the tutorial examples, specify a prefix map-
ping:
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/* </url-pattern>
</servlet-mapping>
...
<welcome-file-list>
<welcome-file>faces/greeting.xhtml</welcome-file>
</welcome-file-list>
The following elements, also commonly used in the tutorial examples, specify an exten-
sion mapping:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
...
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>