Jsf 2 使用<;p:ajax>;在JSF中,UIRepeat防止呈现组件
我有一个jsf,我想在这里显示一个复选框列表。如果我像下面的示例中那样创建它,复选框将正确呈现Jsf 2 使用<;p:ajax>;在JSF中,UIRepeat防止呈现组件,jsf-2,primefaces,Jsf 2,Primefaces,我有一个jsf,我想在这里显示一个复选框列表。如果我像下面的示例中那样创建它,复选框将正确呈现 <p:outputPanel layout="block" rendered="#{scheduleConfigBean.selectedMonthType == 1}" style="width: 400px; margin-top: 45px"> <ui:repeat var="monthDay" value="#{scheduleConfigBean.monthDays}"
<p:outputPanel layout="block" rendered="#{scheduleConfigBean.selectedMonthType == 1}" style="width: 400px; margin-top: 45px">
<ui:repeat var="monthDay" value="#{scheduleConfigBean.monthDays}">
<p:selectBooleanCheckbox value="#{monthDay.checked}" />
<h:outputText value="#{monthDay.name}" />
</ui:repeat>
</p:outputPanel>
但是,当我向每个复选框添加ajax事件侦听器时,面板将不再呈现。我这里有什么问题
<p:outputPanel layout="block" rendered="#{scheduleConfigBean.selectedMonthType == 1}" style="width: 400px; margin-top: 45px">
<ui:repeat var="monthDay" value="#{scheduleConfigBean.monthDays}">
<p:selectBooleanCheckbox value="#{monthDay.checked}">
<p:ajax listener="#{scheduleConfigBean.updateMonthlyButtonState}" update="saveBtn" />
</p:selectBooleanCheckbox>
<h:outputText value="#{monthDay.name}" />
</ui:repeat>
</p:outputPanel>
多亏了达卡,他的回答给了我答案
<p:outputPanel layout="block" rendered="#{scheduleCreate.selectedMonthType == 1}" style="width: 500px; margin-top: 45px">
<c:forEach items="#{scheduleCreate.monthDays}" var="monthDay" varStatus="status">
<p:selectBooleanCheckbox value="#{monthDay.checked}" style="margin-left: 8px">
<p:ajax listener="#{scheduleCreate.updateButton}" update="saveBtn" />
</p:selectBooleanCheckbox>
</c:forEach>
</p:outputPanel>
我想我的朋友应该帮助你