10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basic Requirements of a <strong>Java</strong>Server Faces Application<br />

456<br />

faces-config.xml<br />

tag library descriptors (optional)<br />

classes/<br />

class files<br />

Properties files<br />

lib/<br />

JAR files<br />

<strong>The</strong> web.xml file (or deployment descriptor), the set of JAR files, and the set of application files<br />

must be contained in the WEB-INF directory of the WAR file.<br />

Configuring an Application with a Deployment<br />

Descriptor<br />

Web applications are configured using elements contained in the web application deployment<br />

descriptor. <strong>The</strong> deployment descriptor for a <strong>Java</strong>Server Faces application must specify certain<br />

configurations, which include the following:<br />

■ <strong>The</strong> servlet used to process <strong>Java</strong>Server Faces requests<br />

■ <strong>The</strong> servlet mapping for the processing servlet<br />

■ <strong>The</strong> path to the configuration resource file if it is not located in a default location<br />

<strong>The</strong> deployment descriptor can also specify other, optional configurations, including:<br />

■ Specifying where component state is saved<br />

■ Encrypting state saved on the client<br />

■ Compressing state saved on the client<br />

■ Restricting access to pages containing <strong>Java</strong>Server Faces tags<br />

■ Turning on XML validation<br />

■ Verifying custom objects<br />

This section gives more details on these configurations. Where appropriate, it also describes<br />

how you can make these configurations using NetBeans IDE.<br />

Identifying the Servlet for Life Cycle Processing<br />

One requirement of a <strong>Java</strong>Server Faces application is that all requests to the application that<br />

reference previously saved <strong>Java</strong>Server Faces components must go through FacesServlet.A<br />

FacesServlet instance manages the request processing life cycle for web applications and<br />

initializes the resources required by <strong>Java</strong>Server Faces technology.<br />

Before a <strong>Java</strong>Server Faces application can launch the first JSP page, the web container must<br />

invoke the FacesServlet instance in order for the application life cycle process to start. <strong>The</strong><br />

application life cycle is described in the section “<strong>The</strong> Life Cycle of a <strong>Java</strong>Server Faces Page” on<br />

page 311.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!