0

I have a problem using a <ui: repeat> inside another <ui: repeat>. Let's see the code to explain it better:

<h:form>
  <ui:repeat  value="#{myManagedBean.listDocsFather}" var="dad">
    <p:commandLink update="myPanel" process="@this" >
      <f:setPropertyActionListener target="#{myManagedBean.doc}" value="#{dad.docId}" />
        <div>
          <h:outputLabel value="Document #{dad.docId.name} " />
        </div>
     </p:commandLink>

     <!--here I execute a method to find the father's children's documents-->
     <ui:repeat  value="#{myManagedBean.listDocsSons(dad.id)}" var="child"> 
       <p:commandLink update="myPanel" process="@this" >
         <f:setPropertyActionListener target="#{myManagedBean.doc}" value="#{child.docId}" />
         <div>
             <h:outputLabel value="Document child #{childs.docId.name} " />
          </div>
       </p:commandLink>
     </ui:repeat> 

   </ui:repeat>     

   <h:panelGroup id="myPanel" >
     <!--if docId not null see my document-->     
   </h:panelGroup>
</h:form>

My problem is that many times my listDocsSons method is executed, even though the parent only has a record, that I am doing wrong or how could find the children documents, it is important to clarify that this code works nevertheless presents performance problems when running so many times the same method for a parent. Help me please !! I'm new to JSF.

Dagon
  • 145
  • 2
  • 12
  • Sure you are using JSP??? https://stackoverflow.com/questions/7006104/how-to-use-facelets-uirepeat-tag-in-jsp – Kukeltje Sep 28 '17 at 17:21
  • Please read all jsf Q/A with more than 40 upvotes. Remember they exist (not memorising) and check them again if you run into an issue. – Kukeltje Sep 28 '17 at 17:23
  • This is my composition: sorry but I still do not understand your answer... – Dagon Sep 28 '17 at 23:59
  • I did not give an answer just a comment. And the link should be obvious in relation to the tags – Kukeltje Sep 30 '17 at 11:34
  • Hello thanks for your comments, I did not know the JSF life cycle, thanks to this I could find a solution to my problem, using Hibernate and getting the daughter list since the parent list query is executed. Greetings. – Dagon Sep 30 '17 at 19:26

0 Answers0