13 Replies Latest reply on Apr 4, 2007 2:45 PM by adambrod

    a4j:include problem

    Alexander Belov Novice

      I have a problem with <a4j:include> component.
      I am working with Ajax4JSF 1.1 + Facelets 1.1.12 + JSF RI 1.2_04 + RichFaces3.0 now. And I want to use EL-expression as value of "src" attribute.

      For example:

      <a4j:include src="#{bean.pageName}"/>


      I have an exception this way. Can I do so?
      Now I have to use templates fo Facelets and it is not very usefull. I tried to do the same with <ui:include> (documentation of Facelets says, that I can use EL-expressions), but I have an error too.

      How can I use EL to include the other page to the current?


        • 1. Re: a4j:include problem
          Ilya Shaikovsky Master

          use proper attribute. For me works fine.

          <a4j:include viewId="#{bean.property}"/>
          


          • 2. Re: a4j:include problem
            Alexander Belov Novice

            I have used the same too. I have the same problem.

            • 3. Re: a4j:include problem
              Ilya Shaikovsky Master

              post please the stacktrace.

              • 4. Re: a4j:include problem
                Alexander Belov Novice

                 

                javax.faces.FacesException: UIInclude component j_id28 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.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 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.ui.DefineHandler.apply(DefineHandler.java:58)
                 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.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
                 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 com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
                 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:217)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
                 at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
                 at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
                 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
                 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
                 at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
                 at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
                 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
                 at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
                 at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
                 at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
                 at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
                 at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
                 at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
                 at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
                 at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
                 at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
                Caused by: javax.faces.FacesException: UIInclude component j_id57 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.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                 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.ui.DefineHandler.apply(DefineHandler.java:58)
                 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.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
                 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)
                 ... 71 more
                


                • 5. Re: a4j:include problem
                  Alexander Belov Novice

                  Method returns "/pageName.xhtml"

                  • 6. Re: a4j:include problem
                    Ilya Shaikovsky Master

                    my case

                    <a4j:include viewId="#{bean.property}"></a4j:include>
                    


                    public String getProperty() {
                     return "/pages/greeting.xhtml";
                    }
                    


                    works fine for ajax4jsf 1.1.0
                    may be configuration issue?.. :/ may be you define two viewhandlers (both in faces-config and web.xml)?


                    • 7. Re: a4j:include problem
                      Alexander Belov Novice

                      Of course, no. I have been using ajax4jsf for 5 months.
                      Everything works good, but this feature...

                      Well, thank you. I'll try to do something. Maybe it's connected with using templates on the same page...

                      • 8. Re: a4j:include problem
                        Sergey Smirnov Master

                        http://anonsvn.jboss.org/repos/ajax4jsf/trunk/framework/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java:

                        throw new FacesException("UIInclude component "
                         + component.getClientId(ctx.getFacesContext())
                         + " could't include page with path " + path, e);
                        

                        So, if we have:

                        javax.faces.FacesException: UIInclude component j_id28 could't include page with path
                        at org.ajax4jsf.taglib.html.facelets.IncludeHandler.applyNextHandler(IncludeHandler.java:87)


                        It might mean the path is empty. I.e, your #{bean.pageName} just returns null (or empty string), but not the page name as you expected.

                        • 9. Re: a4j:include problem
                          Alexander Belov Novice

                          My method is:

                          public String getPageName()
                          {
                           return "/simple.xhtml";
                          }


                          To tell the truth, I don't now, how it can return null or empty string.

                          • 10. Re: a4j:include problem
                            Sergey Smirnov Master

                            For the testing purpose, put
                            <h:outputText value="#{bean.pageName}"/> before the <a4j:include>

                            • 11. Re: a4j:include problem
                              Alexander Belov Novice

                              It seems, <a4j:include> doesn't support "rendered" attribute.
                              I've created the empty page and everything works fine.
                              The documentation says:

                              "If "false", this component is rendered."

                              I have thought that there is a mistake. But it seems, that it's true. And there is my question: why this component doesn't support this useful attribute?

                              • 12. Re: a4j:include problem
                                Ilya Shaikovsky Master

                                Yes this small mistake will be fixed after documentation rebuild. Thanks.

                                • 13. Re: a4j:include problem
                                  adambrod Newbie

                                  Make sure you don't have a redirect in your navigation rules. Redirects will break a4j:include...