View RSS Feed


JSF Life Cycle

Rate this Entry
, 07-07-2012 at 05:47 PM (953 Views)
JSF web applicationís life cycle takes its start when a request is made by a user. When a page is submitted various other tasks would be performed, for example data validation given in the components, conversion of data etc. Therefore various steps are present which are followed by an application which is known to be the life cycle.

Name:  1.jpg
Views: 777
Size:  59.3 KB

JSF Life Cycle

1. Restore view phase:
When a JSF page is requested by a user by clicking a button or link, this phase would start out. During this phase, pageís view generation, validators and componentís binding to event handlers would be performed. View would get saved inside the object FacesContext.

2. Apply request values phase:
Main purpose of this phase is to retrieve the current state of every component. When component tree is restored in the previous phase, new value is retrieved by each component present in tree and is stored locally.

3. Process validations phase:
In this phase, local values that have been stored for tree components would be made compareable with the rules of validation. When invalidity is present for the local values error messages would be added into the FacesContext. Component is then treated to be invalid. Jsf would be proceeding to render out the reponse phases so that the current view could be displayed that shows the validation error message.

4. Update model values phase:
When data validation has been confirmed in previous phase, local values could be set with the backing beans. Therefore updation of the bean properties would be done. When it is not possible to convert the local data into those types that have been specified by the properties of beans, life cycle would directly be proceeding towards the phase of render response. Then, errors would be shown.

5. Render response phase:
During this phase, page is rendered back towards user by the JSP container when the application uses JSP. If this request is the initial one then addition of the components would be done to the component tree. In case its not initial, components would not get added as they are added already to the tree. When content of view is rendered, response state is saved. Hence it could be accessed by the subsequent requests and is present for restoration of the view phase.

Submit "JSF Life Cycle" to Facebook Submit "JSF Life Cycle" to Digg Submit "JSF Life Cycle" to Submit "JSF Life Cycle" to StumbleUpon Submit "JSF Life Cycle" to Google