Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse the JSF lifecycle

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to analyze the JSF life cycle, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

JSF lifecycle

Basically, every component of JSF is replaceable, such as Converter, Validator, Component, Renderer, and so on. Each component can be replaced to make JSF more flexible when used.

But the relative cost is the complexity of component composition, so basically, if you plan to customize some JSF components, you must know something about each stage of JSF lifecycle processing requests.

Each stage and simple description when JSF processes the request. The start state is when the client sends the request, and the termination state is equivalent to the response issued by the painter:

After deducting event handling, the JSF life cycle must go through a total of six phases:

◆ reply screen (Restore View)

For the selected page, a new component tree is created if it is viewed for the first time. If it is a session phase, it looks for data from the data on the user side or the server side to restore the state of each component and rebuilds the component tree. If the request parameter is not included, the response is drawn directly by skipping the next stage.

◆ Application value (Apply Request Values)

Each component attempts to find its own parameters from the incoming request and update the element value, where the ActionEvent is triggered, the event is queued, and then the event handler is actually handled by the event handler after the application phase is invoked. However, for a command (Commamnd) component that sets immeduate to true, it handles the event immediately and skips the subsequent phase to draw the response directly, while for the input (Input) component that sets immediate to true, it immediately performs conversion verification and handles the value change event, and then skips the next stage and draws the response directly.

◆ performs authentication (Process Validations)

Perform conversion and validation processing, if the validation error, will skip the later stage, directly draw the response, the result is to re-call the same page drawing result.

◆ updates model values (Update Model Values)

Update each backing bean or model object that is bound to the component.

◆ evokes the application (Invoke Application)

Handle action events and perform back-end application logic.

◆ drawing response (Render Response)

Use the painter to draw the page.

If you just want to "use" JSF, the most basic thing you need to know is the three phases of "performing validation", "updating model values", and "evoking the application" and the event triggering in the middle. The JSF reference implementation hides the complexity of the phases other than these three phases, and you don't need to know the processing details of these phases.

However, if you want to customize components, you must also know how the "reply screen", "apply request values" and "draw response" phases are handled, which are quite complex. Fortunately, you can use the framework provided by JSF to customize components, and the framework provided by JSF has greatly reduced the complexity of component implementation.

Of course, even if the JSF framework reduces the complexity, it is actually very complicated to deal with JSF custom components. Before you try to develop custom components, you can search some websites, such as Apache MyFaces http://myfaces.apache.org/, to see if similar components have been developed, saving you the effort to re-customize the components.

On how to parse the JSF life cycle to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report