<h:selectOneMenu id="selectOneMenu" value="#{Bean1.val1}" >
<f:selectItems value="#{Bean1.selectItems}"/>
<a4j:support event="onchange" action="#{Bean1.onSelectOneMenuChange}" reRender="textbox1 , textbox2 , textbox3, textbox4" />
</h:selectOneMenu>
<h:inputText id="textbox1" value="#{Bean1.textbox1}"> </h:inputText>
<h:inputText id="textbox2" value="#{Bean1.textbox2}"> </h:inputText>
<h:inputText id="textbox3" value="#{Bean1.textbox3}"> </h:inputText>
<h:inputText id="textbox4" value="#{Bean1.textbox4}"> </h:inputText>
Bean1.onSelectOneMenuChange() will change the value of Bean1.textbox1 , Bean1.textbox2,Bean1.textbox3 and Bean1.textbox4 depending on the value selected (Bean1.val1) .Sometimes , it will change all the textbox value and sometimes it will only changes some textbox value.
When users change the value in the "selectOneMenu" drop down list control , the JSF framework will not call the update model values phase but call the Bean1.onSelectOneMenuChange() directly. After that , the all the textbox are reRender. Because the update model values phase is not called , the values entered by the user is never set the the Bean1 and the original value is shown in the textbox after reRender . So I want to ask:
- How can I manually call the update model values phase inside Bean1.onSelectOneMenuChange() ?How can I get the value input input by the users inside Bean1.onSelectOneMenuChange() and set it to the corresponding fields of the Bean1 ?
2.Another approach is that only reRender those textbox whose values are updated inside the Bean1.onSelectOneMenuChange() .However , there are many cases . For example , a value will change all the textbox value and a values may only change some textbox value.How can I reRender conditionally ? What method is more prefer for maintainability?