Post reply

The message has the following error or errors that must be corrected before continuing:
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Note: this post will not display until it has been approved by a moderator.
Attachments: (Clear attachments)
Restrictions: 20 per post (20 remaining), maximum total size 24.00 MB, maximum individual size 24.00 MB
Uncheck the attachments you no longer want attached
Click or drag files here to attach them.
Other options
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview

Topic summary

Posted by thiruvasagamani
 - Aug 28, 2008, 07:49 PM
The life cycle is defined as the processes and phases needs to go through to generate the response for a given request. For JSF, it consists of following six steps that an application follows when any request comes to the system for the processing.



Phase 1: Restore View

A request comes via the FacesServlet controller. It examines the request and extracts the view ID that is determined by the name of the JSP page. The JSF framework controller uses the view ID to look up the components for the current view. If the view doesn't already exist, the JSF controller creates it. If the view already exists, the JSF controller uses it. The view contains all the GUI components. This phase of the lifecycle presents three view instances: new view, initial view, and post back, and each one handled separately.

Phase 2: Apply request values

In this phase each component retrieves its current state. The components are first retrieved or created from the FacesContext object, followed by their values which are typically retrieved from the request parameters, although they can also be retrieved from cookies or headers. If a component's immediate event handling property is not set to true, the values are just converted. So if the field is bound to an Integer property, the value is converted to an Integer but if value conversion fails, an error message is generated and queued in the FacesContext to be displayed in the render response phase.

Phase 3: Process validation

The first event handling of the lifecycle takes place after the apply request values phase. In this stage, each component have its values validated against the application's validation rules. The validation rules can be pre-defined or defined by the developer. Values entered by the user are compared to the validation rules. If an entered value is invalid, an error message is added to FacesContext, and the component is marked invalid. If a component is marked invalid, JSF advances to the render response phase, which will display the current view with the validation error messages.

Phase 4: Update model values

It updates the actual values of the server-side model, by updating the properties of backing beans (also known as managed beans). Only bean properties that are bound to a component's value will be updated. As this phase happens after validation, so the values copied to bean's properties are also valid.

Phase 5: Invoke application

Here the JSF controller invokes the application to handle Form submissions. The component values are converted, validated, and applied to the model objects, so we can now use them to execute the application's business logic. At this phase the next logical view for a given sequence or number of possible sequences are specified by defining a specific outcome for a successful form submission and returning that outcome.
For example: on successful outcome, move the user to the next page. For this navigation, create a mapping to the successful outcome as a navigation rule in the faces-config.xml file. Once the navigation occurs, can move to the final phase of the lifecycle.

Phase 6: Render response

Render Response view with all of its components in their current state are displayed. The application utilizes common JSF GUI components like Radio List, List, Text Field, Label, Panel etc.