Apply Request Values
- In this phase, the submitted values are coming from the request parameter. Then the request values are set into the backing bean ie.setting to components UIInput
That's not entirely correct. The values are not set into backing beans. They are set into components. Basically the following happens for each UIInput
component in the component tree:
input.setSubmittedValue(request.getParameter(input.getClientId()));
Here input
is UIInput
and request
is HttpServletRequest
.
Update Model Values
- In this phase, processed values are transferred from backing bean (UIInput) to managed beans. (It is our custom defined JSF beans).
Also not entirely correct. UIInput
components are not backing beans. Basically the following happens for each UIInput
component in the component tree:
bean.setProperty(input.getValue());
Here, the bean and property is based on the input's valuebinding, e.g. value="#{bean.property}"
.
All with all, your confusion is clearly in distinguishing between the JSF component tree, the JSF backing beans and the JSF managed beans. The JSF component tree is the one which you've definied in the JSP/Facelets page and as you can obtain by FacesContext#getViewRoot()
. The JSF backing beans are Javabean classes whose properties are bound to the component tree using EL such as #{bean.property}
. The JSF managed beans are concrete instances of those Javabean classes. They can be request, session or application scoped (and in JSF 2.0 also view scoped). It are the managed beans where the values are actually been set and retrieved.
See also
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…