JSF,a4j:support 和 rich:pickList,渲染
JSF, a4j:support and rich:pickList, rerender
如果在选项列表中选择了一个值,我会尝试显示 <a4j:outputPanel>
我的html,第一个picklist触发事件重新渲染第二个picklist
<li class="clearfix"><label class="desc"><sup>*</sup>
<h:outputText value="Services :" /></label>
<div>
<span class="full"> <rich:pickList id="pickService"
value="#{GroupeController.listServices}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<a4j:support event="onlistchange" ajaxSingle="true" reRender="test" />
<f:selectItems
value="#{GroupeController.getListTypeGroupeServices()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickService" /></label>
</div></li>
</a4j:outputPanel>
<a4j:outputPanel id="test" rendered="#{GroupeController.test()}" >
<li class="clearfix"><label class="desc">
<h:outputText value="ACL existantes :" /></label>
<div>
<span class="full"> <rich:pickList id="pickACL"
value="#{GroupeController.listACLSelect}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<f:selectItems
value="#{GroupeController.getAllACL()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickACL" /></label>
</div></li>
</a4j:outputPanel>
</a4j:outputPanel>
<a4j:commandButton id="idAjouter" value="Ajouter"
action="#{GroupeController.ajouterGroupe()}"
onclick="#{rich:component('wait')}.show()" reRender="form,error"
limitToList="true" oncomplete="#{rich:component('wait')}.hide()" />
</rich:panel>
</a4j:outputPanel>
</h:form>
</rich:layoutPanel>
控制器中有test()函数:
public boolean test() {
if (listServices == null) {
return false;
} else {
boolean test = false;
for (String s : listServices) {
if (Integer.parseInt(s) == 2) {
test = true;
}
}
return test;
}
}
当我在选择列表中选择ID为2的项目时,我的函数被调用并且它return正确,但是第二个选择列表仍然没有显示
谢谢,抱歉英文错误,我是这方面的新手
泽尔'
我终于找到了答案:JSF ReRender support with selectBooleanCheckbox
所以有正确的代码,Rerender 的目标已经改变,我已经把我的元素放在包装器中显示。
<a4j:outputPanel>
<li class="clearfix"><label class="desc"><sup>*</sup>
<h:outputText value="Services :" /></label>
<div>
<span class="full"> <rich:pickList id="pickService"
value="#{GroupeController.listServices}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<a4j:support event="onlistchange" ajaxSingle="true" reRender="testWrapper" />
<f:selectItems
value="#{GroupeController.getListTypeGroupeServices()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickService" /></label>
</div></li>
</a4j:outputPanel>
<h:panelGroup id="testWrapper">
<a4j:outputPanel id="test" rendered="#{GroupeController.test()}" >
<li class="clearfix"><label class="desc">
<h:outputText value="ACL existantes :" /></label>
<div>
<span class="full"> <rich:pickList id="pickACL"
value="#{GroupeController.listACLSelect}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<f:selectItems
value="#{GroupeController.getAllACL()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickACL" /></label>
</div></li>
</a4j:outputPanel>
</h:panelGroup>
如果在选项列表中选择了一个值,我会尝试显示 <a4j:outputPanel>
我的html,第一个picklist触发事件重新渲染第二个picklist
<li class="clearfix"><label class="desc"><sup>*</sup>
<h:outputText value="Services :" /></label>
<div>
<span class="full"> <rich:pickList id="pickService"
value="#{GroupeController.listServices}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<a4j:support event="onlistchange" ajaxSingle="true" reRender="test" />
<f:selectItems
value="#{GroupeController.getListTypeGroupeServices()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickService" /></label>
</div></li>
</a4j:outputPanel>
<a4j:outputPanel id="test" rendered="#{GroupeController.test()}" >
<li class="clearfix"><label class="desc">
<h:outputText value="ACL existantes :" /></label>
<div>
<span class="full"> <rich:pickList id="pickACL"
value="#{GroupeController.listACLSelect}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<f:selectItems
value="#{GroupeController.getAllACL()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickACL" /></label>
</div></li>
</a4j:outputPanel>
</a4j:outputPanel>
<a4j:commandButton id="idAjouter" value="Ajouter"
action="#{GroupeController.ajouterGroupe()}"
onclick="#{rich:component('wait')}.show()" reRender="form,error"
limitToList="true" oncomplete="#{rich:component('wait')}.hide()" />
</rich:panel>
</a4j:outputPanel>
</h:form>
</rich:layoutPanel>
控制器中有test()函数:
public boolean test() {
if (listServices == null) {
return false;
} else {
boolean test = false;
for (String s : listServices) {
if (Integer.parseInt(s) == 2) {
test = true;
}
}
return test;
}
}
当我在选择列表中选择ID为2的项目时,我的函数被调用并且它return正确,但是第二个选择列表仍然没有显示
谢谢,抱歉英文错误,我是这方面的新手
泽尔'
我终于找到了答案:JSF ReRender support with selectBooleanCheckbox
所以有正确的代码,Rerender 的目标已经改变,我已经把我的元素放在包装器中显示。
<a4j:outputPanel>
<li class="clearfix"><label class="desc"><sup>*</sup>
<h:outputText value="Services :" /></label>
<div>
<span class="full"> <rich:pickList id="pickService"
value="#{GroupeController.listServices}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<a4j:support event="onlistchange" ajaxSingle="true" reRender="testWrapper" />
<f:selectItems
value="#{GroupeController.getListTypeGroupeServices()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickService" /></label>
</div></li>
</a4j:outputPanel>
<h:panelGroup id="testWrapper">
<a4j:outputPanel id="test" rendered="#{GroupeController.test()}" >
<li class="clearfix"><label class="desc">
<h:outputText value="ACL existantes :" /></label>
<div>
<span class="full"> <rich:pickList id="pickACL"
value="#{GroupeController.listACLSelect}"
copyAllControlLabel="Tout copier"
removeAllControlLabel="Tout supprimer"
copyControlLabel="Copier" removeControlLabel="Supprimer">
<f:selectItems
value="#{GroupeController.getAllACL()}" />
<f:facet name="copyAllControlDisabled">Tout copier
</f:facet>
<f:facet name="removeAllControlDisabled">Tout supprimer
</f:facet>
<f:facet name="copyControlDisabled">Copier
</f:facet>
<f:facet name="removeControlDisabled">Supprimer
</f:facet>
</rich:pickList>
</span> <label><rich:message errorLabelClass="req"
for="pickACL" /></label>
</div></li>
</a4j:outputPanel>
</h:panelGroup>