a4j:commandButton, a4j:commandLink, h:selectBooleanCheckbox
运行下面是一个代码,当点击Save Package Type1时,所有的checkbox的值都不会绑定到Bean.
只有点击Save Package Type2时,才会绑定 checkbox的值,查了半天也不知道原因,先记下来,以后有时间再研究:
<h:form id="mainForm">
..................................
<h:form id="subForm">
<h:panelGroup id="compCardTemplates">
<strong><h:outputLabel value="Comp Card Templates" style="background-Color:gray; align:center" /></strong>
<br/>
<a4j:region rendered="#{agencyEditBean.packageTypeId != null}">
<h:selectBooleanCheckbox id="compCard1" value="#{agencyEditBean.compCardTemplate1}"/>
<h:graphicImage url="/images/compcard/CompCard1.gif"
width="100" height="100" title="CompCard1"/>
<h:selectBooleanCheckbox id="compCard2" value="#{agencyEditBean.compCardTemplate2}"/>
<h:graphicImage url="/images/compcard/CompCard2.gif"
width="100" height="100" title="CompCard2"/>
<h:selectBooleanCheckbox id="compCard3" value="#{agencyEditBean.compCardTemplate3}"/>
<h:graphicImage url="/images/compcard/CompCard3.gif"
width="100" height="100" title="CompCard3"/>
<br/>
<h:selectBooleanCheckbox id="compCard4" value="#{agencyEditBean.compCardTemplate4}"/>
<h:graphicImage url="/images/compcard/CompCard4.gif"
width="100" height="100" title="CompCard4"/>
<h:selectBooleanCheckbox id="compCard5" value="#{agencyEditBean.compCardTemplate5}"/>
<h:graphicImage url="/images/compcard/CompCard5.gif"
width="100" height="100" title="CompCard5"/>
</a4j:region>
<br/>
<a4j:region rendered="#{agencyEditBean.packageTypeId != null}">
<a4j:commandButton id="savePackage" value="Save Package Type2" reRender="page:form:packagePage:subForm:basicInfo,page:form:packagePage:subForm:compCardTemplates,page:form:packagePage:subForm:packageItems"
action="#{agencyEditBean.doSaveAgencyPackage}"/>
</a4j:region>
<div class="admin_buttons">
<div class="submit">
<a4j:commandLink id="savePackage2" reRender="page:form:packagePage:subForm:basicInfo,page:form:packagePage:subForm:compCardTemplates,page:form:packagePage:subForm:packageItems"
styleClass="link_button_green"
action="#{agencyEditBean.doSaveAgencyPackage}" rendered="#{agencyEditBean.packageTypeId != null}">
<span>Save Package Type2</span>
</a4j:commandLink>
</div>
</div>
</h:panelGroup>
</h:form>
............
</h:form>