Lifecycle--JSF

The lifecycle handles two kinds of requests: the initial request and the postback. When a user requests a page for the first time, he or she is requesting the page for the first time. When the user performs a postback, he or she submits the form contained in the page previously loaded into the browser as a result of performing the initial request. When the lifecycle handles the initial request, it only performs the restore view and render response phases because there is no user input or action to handle. Instead, when the lifecycle handles postbacks, it executes all phases.

1. Resume viewing

Build the view root and save into the FacesContext, including event handlers and validators

If this is the initial requirement, create an empty view and the lifecycle renders the response directly ahead of time.

2. Apply the request value

The component extracts the new value from the request parameter. Type conversion happens at this stage.

If renderResponse is called on the FacesContext, skip to the render response phase.

 FacesContext.responseComplete can be called and redirected to a different web application

If set to true immediately, validations, transitions, events will be handled in the stage.

3. Process Verification

Process validator registered on the component. If there are any error messages, the lifecycle goes directly to the render-response phase.

If FacesContext.renderResponse is called, skip to render response phase

Redirect to different web application if FacesContext.responseComplete is called

4. Update model values

Update component values ​​to manage bean properties

Similar to FacesContext.responseComplete

Similar to FacesContext.renderResponse

5. Invoke the application

Handling application level events

Similar to FacesContext.responseComplete

6. Render the response

If using a JSP page, the component will render itself as the JSP container traverses the tags in the page.

If this is the initial request, the components displayed on the page will be added to the component tree when the JSP container executes the page.

 

Reference: https://blog.csdn.net/echohfut

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324448595&siteId=291194637
jsf