I have JSF 1.2. I have 2 SelectOneMenues, both have SelectItem lists map to renting company id. (The value is id, and label is name/code depending on which selectOneMenu).
What happens is that if the second selectOneMenu is changed the first gets the correct value, but not the other way arround. What happens is that both selectOneMenus getters are called, then both their setters and then again both their getters. Leading to the last setter to count. That's wrong. Why are both setters called?! I need the behavior: Either selectOneMenu changed leads to the other be updated.
<h:selectOneMenu style="width:100px;"
value="#{idDetControl.companyId}" id="keyType1">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{GeneralTables.rentingCompanyNumbers}" />
<a4j:sup开发者_C百科port event="onchange" reRender="keyType2" />
</h:selectOneMenu>
<h:outputText value="#{l.name}"/>
<h:selectOneMenu style="width:100px;"
value="#{idDetControl.companyId}"
id="keyType2" >
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{GeneralTables.rentingCompanyNames}" />
<a4j:support event="onchange" reRender="keyType1" />
</h:selectOneMenu>
Both components are submitted because by default the entire form is submitted and processed. Set ajaxSingle="true" on a4j:support to only process that component. BTW, I don't see rich:combobox being used. This should also help: http://mkblog.exadel.com/2009/07/richfaces-region-partial-jsf-tree-processing/
精彩评论