Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

Application Configuration

Previous sections of this chapter have discussed the various resources available to a JavaServer Faces application. These include: converters, validators, components, model objects, actions, navigation handlers, and others. In previous releases, these resources had to be configured programmatically. An ApplicationHandler was required to define page navigation, and a ServletContextListener was required to register converters, validators, renderers, render kits, and messages.

This release introduces a portable configuration resource format (as an XML document) for configuring resources required at application startup time. This new feature eliminates the need for an ApplicatonHandler and a ServletContextListener. This tutorial explains in separate sections how to configure resources in the XML document. See section Setting Up The Application Configuration File (page 819) for information on requirements for setting up the application configuration file. See section Creating Model Objects (page 820) for an explanation of how to use the XML file to create model objects. See section Navigating Between Pages (page 890) for information on how to define page navigation in the XML file. See sections Performing Validation (page 867) and Performing Data Conversions (page 878) for how to register custom validators and converters. See sections Register the Component (page 926) and Register the Renderer with a Render Kit (page 925) for information on how to register components and renderers to an application.

In previous releases, once these resources were created, the information for some of them used to be stored in and accessed from the FacesContext, which represents contextual information for a given request. These resources are typically available during the life of the application. Therefore, information for these resources is more appropriately retrieved from a single object that is instantiated for each application. This release of JavaServer Faces introduces the Application class, which is automatically created for each application.

The Application class acts as a centralized factory for resources such as converters and message resources that are defined in the XML file. When an application needs to access some information about one of the resources defined in the XML file, it first retrieves an Application instance from an ApplicationFactory and retrieves the resource instance from the Application.

Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.