JSF Tutorial (8)-life cycle of apply Request Values Phase

Source: Internet
Author: User

when a componentTreein apostbacksafter the request is restored, each of the componentsRequestTo get their own values in the parameters, which are usedProcessdecodesmethod. This value is stored locally in each component, and the code for this procedure is simpler in the source because the implementation will encapsulate the value of the operation in the Processdecodes method. But honestly, the implementation of this part of JSF is very unsuccessful because there are nearly 2000 lines of code in Uiviewroot , which, this, this ...

(Processdecodes method in Uiviewroot.java)

public void Processdecodes (Facescontext context) {        initstate ();        Notifybefore (context, phaseid.apply_request_values);        try {            if (!skipphase) {                if (Context.getpartialviewcontext (). Ispartialrequest () &&                    ! Context.getpartialviewcontext (). Isexecuteall ()) {                    context.getpartialviewcontext (). Processpartial ( phaseid.apply_request_values);                } else {                    super.processdecodes (context);                }                Broadcastevents (context, phaseid.apply_request_values);            }        } finally {            clearfacesevents (context);            Notifyafter (context, phaseid.apply_request_values);        }    }

If any one of the decoding methods or events of the listener invokes the Renderresponse method in the current Facescontext instance. The creator of the JSF skips the Render Response step. In fact, it's good to understand that when you're dealing with a component's desired value, the page is rendered directly to the user if an error is encountered. But the author in the JSF source code has not found this part of the implementation (decay ~)

If any of the events are added to the queue in this step, JSF will pass this event to the relevant listener.

If the immediate property in some components on the page is set to true then the validation, conversions, and event bindings will all be done in this step, and if any conversion fails this component will produce an error message. And put this information in the facescontext display queue. This information will be displayed in the Render Response step, as does the validation error message in the validation step.

If the program needs to redirect to a different application resource or to produce a response, and the response does not contain any JSF components, call the Facescontext.responsecomplete method directly.

The final component of this step will be given a new value, and the message and time will be placed in the queue for processing.

If the current request is defined as a partial request, the local content is recovered from the facescontext and the local processing method is executed.

Each of the above paragraphs is said to deal with different situations at this stage, or all the situations that should be considered in the Processdecodes method, Apply Request values phase Word: take the value!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.