The JSF application consist of six distinct phases given below:
1. Restore View
2. Apply Request Values
3. Process Validations
4. Update Model Values
5. Invoke Application
6. Render Response
JSF life cycle diagram:
The Restore View is the first phase of JSF life cycle. When a request comes restore view retrieves the component tree for the requested page from FacesContext instance if it is already displayed previously otherwise creates a component tree and save in into FacesContext instance.
Note: If there is no query data then render response phase will execute directly and intermediate phase will not execute.
Apply Request Values:
The Apply Request Values is the second phase of JSF life cycle. In this phase component in the component tree will retrieve their values from request and store them locally.
The Process Validations is the third phase of JSF life cycle. In this phase all convertors and validators are executed on local values and if validation passes all other phases executes normally otherwise JSF implementation adds an error message to the FacesContext instance and render response phase executes directly.
Update Model Values:
The Update Model Values is the fourth phase of the JSF life cycle. In this phase bean properties are updated using corresponding component local values.
The Invoke Application is the fifth phase of the JSF life cycle. In this phase action with the business logic is executed and returns a string which is passed to the navigation handler for navigation.
The Render Response is the last phase of the JSF life cycle. In the phase response is send to the browser.