background image

Application with a Deployment Descriptor

<< JavaServer Faces Application | Extension Mapping >>
<< JavaServer Faces Application | Extension Mapping >>

Application with a Deployment Descriptor

Configuring an Application with a Deployment
Descriptor
Web applications are configured using elements contained in the web application deployment
descriptor. The deployment descriptor for a JavaServer Faces application must specify certain
configurations, which include the following:
The servlet used to process JavaServer Faces requests
The servlet mapping for the processing servlet
The path to the configuration resource file if it is not located in a default location
The deployment descriptor can also specify other, optional configurations, including:
Specifying where component state is saved
Encrypting state saved on the client
Compressing state saved on the client
Restricting access to pages containing JavaServer Faces tags
Turning on XML validation
Verifying custom objects
This section gives more details on these configurations. Where appropriate, it also describes
how you can make these configurations using NetBeans IDE.
Identifying the Servlet for Life Cycle Processing
One requirement of a JavaServer Faces application is that all requests to the application that
reference previously saved JavaServer Faces components must go through FacesServlet. A
FacesServlet
instance manages the request processing life cycle for web applications and
initializes the resources required by JavaServer Faces technology.
Before a JavaServer Faces application can launch the first JSP page, the web container must
invoke the FacesServlet instance in order for the application life cycle process to start. The
application life cycle is described in the section
"The Life Cycle of a JavaServer Faces Page" on
page 313
.
To make sure that the FacesServlet instance is invoked, you provide a mapping to it. The
mapping to FacesServlet can be a prefix mapping, such as /guess/*, or an extension
mapping, such as *.faces. The mapping is used to identify a JSP page as having JavaServer
Faces content. Because of this, the URL to the first JSP page of the application must include the
mapping.
Basic Requirements of a JavaServer Faces Application
Chapter 14 · Configuring JavaServer Faces Applications
459