JAVA SERVER FACES (JSF)

JSF PROJECTS

JSF PROJECT 1

JSF Examples

JSF EXAMPLE

adplus-dvertising
Life cycle of JSF
Previous Home Next

JSF life cycle can defines into six distinct phases, ever phase define below

Following Step include in the Life cycle of JSF
  • Request: A JSF interrogate the servlet/JSP request and extract the incoming parameters.
  • Restore view: It is the first phase of the JSF lifecycle, in which request coming through the FaceContext controller. The controller examine The controller examines the request and extracts the view ID, which is determined by the name of the JSP page. If the view doesn't already exist, the JSF controller creates it
  • Apply Request value: The main purpose of the apply request values phase is for each component to retrieve its current state.
  • Process validation: The first event handling of the lifecycle takes place after the apply request values phase. In which, the values entered by the user are compared to the validation rules. Now the condition check.
    • If an entered value is invalid, an error message is added to FaceContext.
    • If there are no validation errors, JSF proceed to update model values phase.
    • If the validation fails, JSF calls the render response phase, which will display the current view with the validation error messages.
  • Update model value: In such phase the actual value is update at server side, by updating the properties of backing beans ( managed beans).
  • Invoked Application: JSF controller invokes the application for handle the Form submissions. At such phase, a specific outcome for a successful form submission and return that outcome to the next phase.
  • Render Response: Last phase of the Life cycle can be used for display the outcome from the Invoked Application.
FacesContext in JSF

The FaceContext object contain all the state information JSF needs to manage the GUI component's state for the current request in the current session. It is also store the view in its viewRoot property because the viewRoot contains all the JSF component for the current user/view ID.

A FaceContext instance is associated with a particular request at the beginning of request processing, and invoke by getFacesContext() method of the FacesContextFactory instance associated with the current web application. This instance remain active with current web application until a release() method not invoke, after that no further references to this instance are allowed.

Previous Home Next