7 Replies Latest reply on Feb 29, 2008 12:12 AM by bibinsga25

    Passing parameters in a4j:include

    bibinsga25

      Hi,
      I have an a4j:include in my page like

      <a4j:include ajaxRendered="true" id="rightContents" viewId="#{customerTree.currentDynamicView}"/>
      


      and in the backing bean
      public String getCurrentDynamicView() {
       return rightNavs.get(getSelection())+"?id=1";
      }
      
      


      But then I am getting error like

      java.io.FileNotFoundException: /pages/includes/customer-info-edit.jspx?id=1 Not Found in ExternalContext as a Resource

      Please let me know how can I pass a parameter in the request for this dynamic include from the backing bean.Please help.Plsssss

      Thanks
      Bibin

        • 1. Re: Passing parameters in a4j:include
          bibinsga25

          Also when I tried this through updating the request parameter map instead of appending the value in the url,Im getting the following error

          Caused by: javax.el.ELException: /pages/customer-edit.jspx @16,104 viewId="#{customerTree.currentDynamicView}": Error reading 'currentDynamicView'

          • 2. Re: Passing parameters in a4j:include
            bibinsga25

            Is there any way of combining a4j:include and a4j:actionParam??

            • 3. Re: Passing parameters in a4j:include
              bibinsga25

              somebody please respond.Im stuck up with this issue.Please................

              • 4. Re: Passing parameters in a4j:include
                ilya_shaikovsky

                 

                <a4j:include viewId="/pages/included1.xhtml">
                 <ui:param name="param" value="page1"/>
                 </a4j:include>
                


                included page
                <ui:composition>
                 <h:form>
                
                 <h:outputText value="#{param}"></h:outputText>
                 </h:form>
                 </ui:composition>


                after opening page - i'm able to see my param in output.

                • 5. Re: Passing parameters in a4j:include
                  bibinsga25

                  Thanks for the reply...
                  but I am not able to get it from the bean

                  I tried like
                  getHttpRequest().getParameter("param") and its returning null.

                  Actually I want to process something with the id which I am passing with include from the backing beans.Please....

                  • 6. Re: Passing parameters in a4j:include
                    ilya_shaikovsky

                    ok, sorry.. more detailed code:

                    main:

                    <ui:composition template="/templates/common.xhtml">
                     <ui:define name="body">
                     <a4j:outputPanel id="view" >
                     <a4j:include viewId="/pages/included1.xhtml">
                     <ui:param name="currentPage" value="page1"/>
                     </a4j:include>
                     </a4j:outputPanel>
                     </ui:define>
                    </ui:composition>


                    include:
                    <ui:composition>
                     <h:form>
                     <h:commandLink value="submit with current param" action="#{bean.action}">
                     <f:param name="currentPage" value="#{currentPage}"/>
                     </h:commandLink>
                     </h:form>
                     </ui:composition>


                    there you can see that parameter passed to the child page.

                    and bean code:

                    public String action() {
                     System.out.println(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("currentPage"));
                     return null;
                     }
                    


                    there the parameter (passed with f:param) get and printed to console.

                    In my log for this code I have:
                    INFO: BEFORE INVOKE_APPLICATION 5
                    action called
                    page1
                    28.02.2008 18:18:34 org.exadel.jsf.PhaseTracker afterPhase
                    INFO: AFTER INVOKE_APPLICATION 5


                    • 7. Re: Passing parameters in a4j:include
                      bibinsga25

                      Thanks very much for the reply :-)