Java Reference
In-Depth Information
The JavaServer Faces web application framework manages lifecycle phases automatically
for simple applications or allows you to manage them manually for more complex applic-
ations as required.
JavaServer Faces applications that use advanced features may require interaction with the
lifecycle at certain phases. For example, Ajax applications use partial processing features
of the lifecycle. A clearer understanding of the lifecycle phases is key to creating well-de-
signed components.
A simplified view of the JavaServer faces lifecycle, consisting of the two main phases of
a JavaServer Faces web application, is introduced in “The Lifecycle of the hello Applic-
ation” in The Java EE 6 Tutorial: Basic Concepts . This section examines the JavaServer
Faces lifecycle in more detail.
Overview of the JavaServer Faces Lifecycle
The lifecycle of a JavaServer Faces application begins when the client makes an HTTP
request for a page and ends when the server responds with the page, translated to HTML.
The lifecycle can be divided into two main phases, execute and render . The execute
phase is further divided into subphases to support the sophisticated component tree. This
structure requires that component data be converted and validated, component events be
handled, and component data be propagated to beans in an orderly fashion.
A JavaServer Faces page is represented by a tree of components, called a view . During the
lifecycle, the JavaServer Faces implementation must build the view while considering the
state saved from a previous submission of the page. When the client requests a page, the
JavaServer Faces implementation performs several tasks, such as validating the data input
of components in the view and converting input data to types specified on the server side.
The JavaServer Faces implementation performs all these tasks as a series of steps in the
JavaServer Faces request-response lifecycle. Figure 3-1 illustrates these steps.
Search WWH ::




Custom Search