I often get doubt on these two phases. The following is my understanding:
Apply Request Values
Update Model Values
I am thinking that my understanding is correct. But, reading few articles made me confused. I want to make me more clear on these two phases. Please clarify me.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With