The
JSF lifecycle phases use a UI component
tree to manage the display of the faces components. This tree is a runtime
representation of a JSF page: each UI
component tag in a page corresponds to a UI component instance in the tree. The FacesServlet servlet manages the request processing lifecycle in
JSF applications. FacesServlet
creates an object called FacesContext,
which contains the information necessary for request processing, and invokes an
object that executes the lifecycle.
The
JSF Life Cycle is represented by the following diagram:
Photo
Courtesy: Web User Interface Developer's Guide for Oracle ADF
Let’s
understand each phase of the JSF lifecycle:
·
Restore View: The
component tree mentioned earlier is
established. If this is not the initial rendering, the tree is restored with
the appropriate state. If this is the initial rendering, the component tree is
created and the lifecycle jumps to the Render Response phase.
·
Apply Request Values: Each component in the tree extracts new values from the request
parameters and stores the values locally.
If a component has its immediate
attribute set to true, then the
validation, the conversion, and the events associated with the component are processed during this phase.
·
Process Validations: It is one of the most important phases of JSF life
cycle. The process validation is done through the following steps:
§ Conversion: The local
values of components are converted from the input type to the underlying data type.
§ Required Check: If there are no failures in conversion, the required attribute on the component is
checked. If the value is true then it goes for validation.
§ Validation: If the required check condition is true, and the associated field contains a value, then any associated validators are run. If the
value is true and there is no field value, this phase completes (all remaining
validators are executed), but the lifecycle jumps to the Render Response phase.
Condition checking in Validation Process
Phase
·
Update Model Values: The component’s validated local values are moved to the model, and the local copies are
discarded.
·
Invoke Application: Application-level logic (such as event handlers) is executed
·
Render Response:
The components in the tree are rendered.
State information is saved for subsequent
requests and for the Restore View phase.
Thanks Pankaj for sharing ...It really helping.
ReplyDeletegood work keep it up....
ReplyDeleteLooking forward to reading more. Great blog post. Great.
ReplyDeleteSAP Grc training
SAP Grc online training