Lifecycle directs the processing of incoming request parameters, and manages a server-side set of UI components and synchronizes them to what the user sees in a client browser.
It also satisfies follow-up requests for images, style sheets, scripts, and other kinds of resources required to complete the rendering of the UI.
During the execution of the lifecycle, the JSF runtime will:
1. Determine if this is a page request or a resource request. If this is a resource request, it will serve the bytes of the resource to the user-agent. Otherwise, it will load the Facelets or JSP page.
2. Create a server-side representation of the UI.
3. Produce markup suitable for rendering in the browser.
The JSF lifecycle automatically keeps track of the changed portions of the state, so the client-side view is always in step with the server-side view.
1) Restore View phase restores or creates a server-side component tree (View) in memory to represent the UI information from a client. View is a server-side tree of UI components.It is the job of the Restore View phase to either restore an existing View from a previous transaction or create a fresh View based on a new request. If the request is a new one ("nonpostback"), a new View is created and will be stored in a parent container object known as the FacesContext. The FacesContext serves as storage for all of the data pertinent to the current request's run through the request processing lifecycle. UI Component Tree will get created.
2) Apply Request Values Updates the server-side components with fresh data from the client. JSF runtime applies request values to UI components(html) on the View (or UIViewRoot) of the UI component tree.
3) Process Validations Performs validation and data type conversion on the new data. validator will get called.
4) Update Model Values Updates any server-side Model objects with new data. All the variables mapped to xhtml component will get updated with values provided by user. Bean values will get updated.
5) Invoke Application Invokes any application logic needed to fulfill the request and navigate to a new page if needed. On submission from one page by user, method of bean specified in command button will get executed.
6) Render Response Saves state and renders a response to the requesting client.