Ans)
-
Sample Img 2
The six phases of the JSF application lifecycle
are as follows (note the event processing
at
each phase):
1.Restore view
2.Apply request
values; process events
3.Process validations; process
events
4.Update model values; process events
5.Invoke application; process events
6.Render
response
Phase 1: Restore view
In
the first phase of the JSF lifecycle -- restore view -- a request
comes through the FacesServlet
controller. The
controller examines the request and extracts the view ID, which is
determined by the name of the JSP page.
Phase 2: Apply request
values
The purpose of the apply request
values phase is for each component to retrieve its current
state. The components must first be retrieved or created from
the FacesContext object,
followed by their values.
Component values are typically retrieved from the request
parameters,
although they can also be
retrieved from cookies or headers.
Phase 3: Process
validation
The first event handling of
the lifecycle takes place after the apply request values
phase.
At this stage, each component will have its
values validated against the application's
validation rules. The validation rules can be pre-defined (shipped
with JSF) or defined by the developer
Phase 4: Update
model values
The fourth phase of the JSF
application lifecycle -- update model values -- updates the
actual
values of the server-side model -- namely, by
updating the properties of your backing beans
(also
known as managed beans).
Phase 5: Invoke
application
At the fifth phase of the
lifecycle -- invoke application -- the JSF controller invokes
the
application to handle Form submissions.
Phase 6:
Render response
In the sixth phase of the
lifecycle -- render response -- you display the view with
all
of its components in their current state.
Back to top