Explain the JSF life cycle.The life cycle of JSF is similar to JSP. A JSF page is represented by the UI components which are in tree nature. This is called a view. The JSF lifecycle starts when the client requests for a page. During the lifecycle, the view must be built by the JSF implementation taking into consideration the state of the previous page submission. When a page is submitted by a client, the JSF implements the tasks such as - data input validation of the view components and converting the input data to that of types specified by the server side. In the life cycle the JSF performs all these designated tasks in a series of steps.
Explain the JSF life cycle.i. Restore view phase: This phase starts when a user requests a JSF page by clicking a link, button etc. In this phase view generation of the page, binding of components to its event handlers and validators are performed and view is saved in the FacesContext object.
ii. Apply request values phase: The purpose of this phase is for each component to retrieve its current state.
iii. Process validations phase: During this phase local values stored for the component in the tree are compared to the validation rules registered for the components.
iv. Update model values phase: After confirming that data is valid in the previous phase local values of components can be set to corresponding server side object properties i.e. backing beans.
v. Invoke application phase: Before this phase the component values have been converted, validated, and applied to the bean objects, so you can now use them to execute the application's business logic.
vi. Render response phase: In this phase JSP container renders the page back to the user, if jsp is used by application i.e. view is displayed with all of its components in their current state
|