The JSF lifecycle plays a vital role in JSF applications, and each JSF request is processed through a lifecycle, and this article analyzes the JSF lifecycle from a source perspective.
Before we discuss the lifecycle, let's discuss some of the elements of Facescontext, who play a very important role throughout the lifecycle. A JSF application must save the requested information it processes, Facescontext saves all the necessary contextual information for processing requests and generating responses, specifically, it includes:
1. Information queue, MessageQueue, save all messages
2. The current component tree, Viewroot,
3. External context, Externalcontext
4.Application.
Here are the variables in Sun's Facescontextimpl:
Com.sun.faces.context.FacesContextImpl:
Relationshipinstancevariables
Privateresponsestreamresponsestream=null;
Privateresponsewriterresponsewriter=null;
Privateexternalcontextexternalcontext=null;
Privateapplicationapplication=null;
Privateuiviewrootviewroot=null;
Privateelcontextelcontext=null;
Privaterenderkitfactoryrkfactory;
PRIVATERENDERKITLASTRK;
Privatestringlastrkid;
Privatebooleanrenderresponse=false;
Privatebooleanresponsecomplete=false;
There are a lot of important objects that we should study, and in order from top to bottom, let's look at Externalcontext first.
Externalcontext is actually an encapsulation of servletcontext (or Portletcontext) that provides various ways to access external container resources, externalcontext the base class definition as follows:
Javax.faces.context.ExternalContext:
publicabstractclassexternalcontext{
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.