Hello. I am trying to understand the lifecycle of
JSF. Can somebody explain the following very simple behaviour:
I create a UIInput component and a UICommand to go with it
<h:inputText id="name">
</h:inputText>
<h:commandButton value="submit Here"
action="success"></h:commandButton>
The "success" action brings you back to the same page.
I would think that in the "apply request value" phase, if I enter lets
say "Peter" in the inputText, it would save "Peter" in the value for the inputText Component. No Backing bean associanted,so nothing to do in the "Update Model Values" phase. When the view is rendered in the "Render Response" page, I would think that "Peter" should be the value display in the page since it was saved in the "Apply Request Values" phase. Nevertheless is empty.
If I run the same code but now with an association to a backing bean property:
<h:inputText id="name" value="#{inbox.name}">
</h:inputText>
<h:commandButton value="submit Here"
action="success"></h:commandButton>
The page coming back contains "Peter" as I would have expected to happen, not only in this case but in the previous case.
I believe I have a big confusion on when do the component values get in sync with the model values. In the books it shows very simple. Component values get updated in Apply Request Values, and everything is synch in Update Model Values. But what happens if the model values or the component values are changed in the Invoke Application Phase. Do they get resync before it is rendered and sent back?
The only explanation that I can come up to my observation above is that prior to rendering the model and the component get resync and since there was not model, the value of the component gets reset to null.
Any help would be greatly appreciated since a lot of my JSF question have to do with this issue.
Thanks a lot
Jorge