内部UI:repeat不会绑定到嵌套UI:repeat中的bean [英] Inner UI:repeat does not bind to a bean in a nested UI:repeat
问题描述
我正在使用嵌套的ui:repeats显示我的数据.外部UI:repeat可以正常工作并绑定到bean,但是内部UI不绑定到bean.总而言之,我想显示一个人的列表,其中每个人都有一个名字和一个电子邮件地址列表.这是我的代码:
I am using nested ui:repeats to display my data. the outer UI:repeat works and binds to bean just fine, but the inner does not bind to the bean. In sumary, I would like to display a list of people where each person has a name and a list of email addresses. Here is my code:
<ui:repeat value="#{myFamily.personList}" var="eachPerson" >
<tr:panelCaptionGroup captionText="#{eachPerson.name}" styleClass="fullWidth">
<h:inputText value="#{eachPerson.age}" styleClass="fullWidth" />
<ui:repeat value="#{eachPerson.emailList}" var="eachEmail" >
<h:panelGrid columns="2">
<h:outputLabel value="#{eachEmail.type}:" styleClass="darkBlue label" />
<h:inputText value="#{eachEmail.email}" maxlength="40" size="38" />
</h:panelGrid>
</ui:repeat>
</tr:panelCaptionGroup>
</ui:repeat>
与personList的绑定很好,因为我通过更改每个人的年龄进行了测试,并且在提交后更改了模型.但是,无论我在屏幕上进行什么更改,电子邮件列表都不会更改.
The binding to the personList was fine since I had tested by changing the age of each person and the model changed after I submit. However, the emails list is not changed no matter what I change on the screen.
请帮助!我正在使用JSF,Spring Web Flow,Facelets和Trinidad.
Please help! I am using JSF, Spring Web Flow, Facelets, and Trinidad.
推荐答案
感谢您的快速响应.在Google花了一些时间后,我发现嵌套的UI:repeat是很好的支持.您可以使用其他替代方法,例如tr:iterator,c:forEach和/或tr:forEach.
Thank you for you quick response. After spending some time on google, I found out that nested UI:repeat is well suported. You can use different alternatives like tr:iterator, c:forEach, and/or tr:forEach.
我想澄清的一件事是,c:forEach和ui:repeat确实将值绑定到支持bean,并且在jsf和facelets中得到了很好的支持.
One thing I'd like to clearify that c:forEach and ui:repeat do bind values to the backing beans and well supported in jsf and facelets.
这篇关于内部UI:repeat不会绑定到嵌套UI:repeat中的bean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!