5 Replies Latest reply on Mar 29, 2007 7:50 PM by Sergey Smirnov

    using include from within a repeat?

    Dustin Norlander Apprentice

      Hello,

      I would like to be able to do the following:

       <a:repeat value="#{exBean.templateList}" var="template" >
       <ui:include src="#{template}" />
      </a:repeat>
      


      I realize that this is not possible with facelets, but I thought there might be an applicable richfaces element that I could use (or possibly someone knows a workaround)? If not, this component would be highly useful.

      thanks,
      Dustin

        • 1. Re: using include from within a repeat?
          Sergey Smirnov Master

          do you have the same result with a4j:include.

          Note, it has no src attribute, but viewId instead.

          • 2. Re: using include from within a repeat?
            Dustin Norlander Apprentice

            A very simple case does work. But if I try to involve the repeat variable everything goes crazy (get exceptions until the heap overflows)..

            Here is a simple test case (project generated with the latest seam-gen)

            Bean:

            @Name("exBean")
            public class ExampleBean {
             public ExampleBean() { }
            
            //creates a list with template names
             public List<String> getList() {
             List<String> l = new ArrayList<String>();
             for (int i=0; i < 2; i++) {
             l.add("/layout/test.xhtml");
             }
             return l;
             }
            }
            


            and in the page:

            <a:repeat value="#{exBean.list}" var="s" >
             <a:include viewId="${s}" />
            </a:repeat>
            


            and the include "layout/test.xhmtl"

            <s:fragment
             xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib" >
             Hello <br />
            </s:fragment>
            


            thanks for any help,
            Dustin

            • 3. Re: using include from within a repeat?
              Sergey Smirnov Master

              Could you post the exception text?

              • 4. Re: using include from within a repeat?
                Dustin Norlander Apprentice

                Here is the beginning (like I said, they go on and on until the heap overruns)



                SEVERE: Error Rendering View[/home.xhtml]
                javax.faces.FacesException: UIInclude component _id14 could't include page with path
                 at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:87)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
                 at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
                 at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
                 at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                 at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                 at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                 at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:595)
                Caused by: javax.faces.FacesException: UIInclude component _id29 could't include page with path
                 at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:87)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
                 at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
                 at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at co
                2007-03-29 15:52:47,282 ERROR [STDERR] m.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:85)
                 ... 66 more
                Caused by: javax.faces.FacesException: UIInclude component _id44 could't include page with path
                 at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:87)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
                 at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
                 at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:85)
                 ... 94 more