Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

jsf - Inner UI:repeat does not bind to a bean in a nested UI:repeat

HI, 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>

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.

Please help! I am using JSF, Spring Web Flow, Facelets, and Trinidad.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...