7 Replies Latest reply on Oct 30, 2007 9:30 AM by pmuir

    Nested ui:repeat fails

    erik.d.hellman

      I have a page where I first iterate over a list and for each object in the list I need to do another iteration. The code looks something like this:

      <ui:repeat var="foo" value="#{firstList}">
      .... write some output...
       <ui:repeat var="bar" value="#{foo.children}">
       ... write some output...
       </ui:repeat>
      </ui:repeat>


      firstList is a @DataMode-annotated List-object in my @Name annotated Pojo. The page displays correctly during the first couple of calls to the page (usually between 2-5 times), but then it sudddenly fails and stops rendering content within the ui:repeat-tag after the first object in foo.children.

      I found a workaround by using a4j:repeat inside ui:repeat, but in my opinion this is a bug since it doesn't fail at first but after a few couple of calls to the page. Am I right or have I misunderstood how the ui:repeat-tag works?

      Thanks!

      // Erik

        • 1. Re: Nested ui:repeat fails
          pmuir

          Which version of facelets (a bug like this was fixed in the most recent release of facelets).

          • 2. Re: Nested ui:repeat fails
            susnet

            When I read the nabble forum for facelets there seems to still be bugs in this, but I didn't really get which version it concerns, only that there are open bugs.

            If the bug in ui:repeat is solved i want to use it but if it is not i have read in serveral places that you should use tomahawk datalist instead.

            I have tried that and managed to get it to work in one of my seam projects but now I have problem another seam project which uses JBPM. I'm using Seam 1.2.1. Is this suppose to work?

            My question is - Is the tomahawk datalist (and because i have to install the whole tomahawk jar to just use this datalist component) fully compatible with seam? Which version of tomahawk do you recommend use together with seam 1.2.1 and 2.0.0?
            Or even better, do you have some other replacement for ui:repeat in some seam library or other library you have tested and knows works, since i run my applications in production it is nice if they work. :-)

            • 3. Re: Nested ui:repeat fails
              pmuir

              I suggest you use the latest version of facelets (in which this bug has been fixed. Facelets 1.1.14) and ui:repeat and not tomahawk at all. If you still see this problem with Facelets 1.1.14 then post on the facelets mailing list.

              • 4. Re: Nested ui:repeat fails
                susnet

                I found out the problem why it did not work using tomahawk dataList for me. The problem was that i use JBoss 4.2 in my new seam project and then you also have to include the commons-el.jar to your webapp lib.

                Here is a complete tutorial on how to use tomahawk dataList in a Seam project on JBoss 4.2:

                1. Add tomahawk.jar to your webapp lib.
                2. Add commons-el.jar to your webapp lib.
                3. Take the following code and put it into a file and name it tomahawk.taglib.xml and put this file directly under your WEB-INF directory.

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE facelet-taglib PUBLIC
                "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
                "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
                
                <facelet-taglib>
                 <namespace>http://myfaces.apache.org/tomahawk</namespace>
                
                 <tag>
                 <tag-name>dataList</tag-name>
                 <component>
                 <component-type>org.apache.myfaces.HtmlDataList</component-type>
                 <renderer-type>org.apache.myfaces.List</renderer-type>
                 </component>
                 </tag>
                </facelet-taglib>
                


                4. Put the following code in your web.xml
                <context-param>
                 <param-name>facelets.LIBRARIES</param-name>
                 <param-value>/WEB-INF/tomahawk.taglib.xml</param-value>
                 </context-param>
                


                5. In those xhtml files you want to use tomahawk dataList add
                xmlns:t="http://myfaces.apache.org/tomahawk"

                and then just use the dataList for example like this:
                <t:dataList value="#{allCategories.resultList}" var="cat">
                 <p>#{cat.name}</p>
                </t:dataList>
                


                • 5. Re: Nested ui:repeat fails
                  erik.d.hellman

                   

                  "pete.muir@jboss.org" wrote:
                  I suggest you use the latest version of facelets (in which this bug has been fixed. Facelets 1.1.14) and ui:repeat and not tomahawk at all. If you still see this problem with Facelets 1.1.14 then post on the facelets mailing list.


                  Tried upgrading to Facelets 1.1.14 but then my pages won't show up at all (i.e., blank page presented but no exceptions generated in the server-log) I guess some other library needs to be updated? Any suggestions on what could cause this?

                  • 6. Re: Nested ui:repeat fails

                     

                    "erik.d.hellman@gmail.com" wrote:
                    "pete.muir@jboss.org" wrote:
                    I suggest you use the latest version of facelets (in which this bug has been fixed. Facelets 1.1.14) and ui:repeat and not tomahawk at all. If you still see this problem with Facelets 1.1.14 then post on the facelets mailing list.


                    Tried upgrading to Facelets 1.1.14 but then my pages won't show up at all (i.e., blank page presented but no exceptions generated in the server-log) I guess some other library needs to be updated? Any suggestions on what could cause this?


                    where is Facelets 1.1.14? the latest release I see on their site is 1.1.13.

                    • 7. Re: Nested ui:repeat fails
                      pmuir