Q. Explain briefly the life-cycle phases of JSF?


1. 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


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.Values provided in components that hold a value (such as input fields) have their values applied to their counterparts in the view tree. All events such as ValueChangeEvents (VCE) or ActionEvents (AE) are queued. A VCE means that a value has changed for a specific UI component. An AE means that a button (or any UI component that is a source of an action) was clicked. If a component has its immediate attribute set to true, then validation, conversion, and events associated with the component are processed during this phase.

3. Process validations: In this phase, each component will have its values validated against the application’s validation rules.Conversion and validation logic is executed for each component. This means both built-in validation/data conversion and custom validation/conversion are added onto the components. If a validation error is reported, an exception is thrown. The life cycle halts and the response is rendered with validation error messages. At the end of this phase, new component values are set, any validation or conversion error messages and events are queued on FacesContext, and any value change events are delivered.

4. Update model values: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.The component’s validated local values are moved to the model and the local copies are discarded. If you are using a backing bean for a JSF page to manage your UI components, any managed bean properties that are value-bound to the UI component using the value attribute are updated with the value of the component

5. Invoke application: In this phase the JSF controller invokes the application to handle Form submissions.

6. Render response: In this phase JSF displays the view with all of its components in their current state.Any action bindings for command components or events are
invoked. Navigation is handled here depending on the outcome of action method (if any).

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube