问题
While using <c:forEach>
the items values is not substituted properly. If i use <a4j:repeat>
or <ui:repeat>
instead of <c:forEach>
inside a <rich:dataTable
>, radio button is not rendering properly. I also found reason for this in http://community.jboss.org/wiki/Cantusea4jrepeattoiteratethemenuItemstabsetc
How do I resolve this issue?
<f:selectItems>
is working inside but i want to send a choice type to server
<rich:dataTable var="answer" value="#{answers}">
<rich:column>
<f:selectOneRadio value="#{response.value}">
<c:forEach items="#{answer.choices}" var="choice">
<f:selectItem itemLabel="#{choice.value}" itemValue="#{choice.type}"/>
</c:forEach>
</f:selectOneRadio>
</rich:column>
</rich:dataTable>
回答1:
If you're already on JSF 2.x, then you can just use the following construct:
<f:selectItems value="#{answer.choices}" var="choice" itemValue="#{choice.type}" itemLabel="#{choice.value}" />
If you're still on JSF 1.x, then best is to use f:selectItems
in combination with the following logic in the constructor of answer
bean to prepopulate it:
this.selectItems = new ArrayList<SelectItem>();
for (Choice choice : this.choices) {
selectItems.add(new SelectItem(choice.getType(), choice.getValue()));
}
so that you can end up with
<f:selectItems value="#{answer.selectItems}" />
来源:https://stackoverflow.com/questions/2166934/using-a4jrepeat-or-uirepeat-inside-richdatatable-doesnt-render-radio-buttons