JSF Page Life Cycle

JSF Life Cycle

The Restore View phase 
  • Retrieves the component tree for the requested page if it was displayed previously  OR
  • Constructs a new component tree if it is displayed for the first time.
  • Render Response phase
  • If there are no request values, the JSF implementation skips ahead to the Render Response phase. 
  • This happens when a page is displayed for the first time.
Apply Request Values phase
  • Otherwise, the next phase is the Apply Request Values phase. 
  • In this phase, the JSF implementation iterates over the component objects in the component tree. 
  • Each component object checks which request values belong to it and stores them.
Process Validations
  • The values stored in the component are called “local values”. 
  • When you design a JSF page, you can attach validators that perform correctness checks on the local values. 
  • These validators are executed in the Process Validations phase. 
  • If validation passes, the JSF life cycle proceeds normally. 
  • However, when conversion or validation errors occur, the JSF implementation invokes the Render Response phase directly, redisplaying the current page so that the user has another chance to provide correct inputs.
Update Model Values 
  • After the converters and validators have done their work, it is assumed that it is safe to update the model data. 
  • During the Update Model Values phase, the local values are used to update the beans that are wired to the components. 
Invoke Application phase 
  • In the Invoke Application phase, the action method of the button or link component that caused the form submission is executed. 
  • It returns an outcome string that is passed to the navigation handler. 
  • The navigation handler looks up the next page. 
Render Response phase:
  • Finally, the Render Response phase encodes the response and sends it to the browser. 
  • When a user submits a form, clicks a link, or otherwise generates a new request, the cycle starts a new.

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form