JSF Life Cycle

This section will describe you JSF life cycle. Life cycle of JSF specifies the phases of execution of JSF based applications.

JSF Life Cycle

JSF Life Cycle

In this section we will discuss about life cycle of JSF.

This section will describe you JSF life cycle. Life cycle of JSF specifies the phases of execution of JSF based applications. A JSF application follows a certain life cycle for every request and response. Request for the JSF page can be generated from the JSF page or a non JSF page and as similar the response can be given to JSF and/or non JSF page. The request and response for the JSF application can be as follows :

  • Non-JSF Request -> Non-JSF Response
  • Non-JSF Request -> JSF Response
  • JSF Request -> Non-JSF Response
  • JSF Request -> JSF Responses

As we have discussed earlier JSF specifies the life cycle phases for any JSF enabled application. JSF life cycle phases are as follows :

  1. Restore View Phase : Restores the required data to process the coming request.
     
  2. Apply Request Values Phase : In this phase each component retrieves the new value from the request parameters and is kept locally on the component.
     
  3. Process Validations Phase : In this phase all the validations that are registered on the components are processed by the JSF implementation.
     
  4. Update Model Values Phase : In this phase if the data is valid the components local value is fix by the corresponding server-side object properties.
     
  5. Invoke Application Phase : In this phase application-level events like form submission, linking to another page are handled.
     
  6. Render Response Phase : This is a final phase of the JSF life cycle. In this phase a response page is assigned for rendering into its container. For example if a response page is a JSP page then it will be rendered to the JSP container.
     

Following image demonstrates the life-cycle of JSF