5 Replies Latest reply on Oct 18, 2007 11:51 AM by ilya_shaikovsky

    problems with a4j:include

    maykellff

      Hi all, i'm trying the a4j:include componente, but it's not function as expected.

      when i try to navigate from the first include page to the second it doesn't work.

      These are my pages:
      inicial page:

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
      
      
      
      <html>
       <head>
       <title></title>
       </head>
       <body>
       <f:view>
       <table id="marco" border="1">
       <tr id="banner">
       <td><h:graphicImage value="/images/banner.jpg" /></td>
       </tr>
       <tr id="body">
       <td>
       Este es el menu...
       </td>
       <td>
       <a4j:outputPanel id="wizard">
       <a4j:include id="i" viewId="b.jsp" />
       </a4j:outputPanel>
       </td>
       </tr>
       </table>
       </f:view>
       </body>
      </html>
      

      Page b.jsp:
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
      
      <html>
       <head>
       <title></title>
       </head>
       <body>
       Esta es la Pagina B
       <a4j:form>
       <a4j:commandButton action="#{bean.beanAction}" value="reset" reRender="wizard"/>
       <h:outputLabel value="#{bean.bannerUrl}">
       </h:outputLabel>
       </a4j:form>
       </body>
      </html>
      


      Page c.jsp:
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
      
      <html>
       <head>
       <title></title>
       </head>
       <body>
       Yo soy C
       </body>
      </html>



      Any help will be appreciated.

        • 1. Re: problems with a4j:include

          What the version of RichFaces (or Ajax4jsf you use)?
          What is the JSF implementation?

          Important points you miss:

          1. included code is the part of the whole page. So, there is no reason to have < html > < head > < body > there.

          2. No reason to point to the outputPanel with reRender attribute (unless you use very very old version of Ajax4jsf)

          3. Use context-related viewId. I.e. let it to be started with "/"

          In general, The code snippet of the #{bean.beanAction} and the navigation rules for the action outcome are missing to make any suggestion.

          • 2. Re: problems with a4j:include
            maykellff

            Hi, i'm using the following versions:

            Myfaces-api ----> 1.1.1
            Tomahawk ----> 1.1.1
            RichFaces -----> 3.0.1
            ajax4jsf ------> 1.1.1

            This is my bean code:


            import javax.faces.context.FacesContext;
            import javax.swing.text.html.HTML;
            import org.ajax4jsf.ajax.UIInclude;

            public class bean {

            private String bannerUrl = "";

            public String getBannerUrl() {
            return bannerUrl;
            }

            public void setBannerUrl(String bannerUrl) {
            this.bannerUrl = bannerUrl;
            }

            public String beanAction()
            {
            this.bannerUrl = "next";
            return "next";
            }
            }



            This is my navigatios rules:
             <navigation-rule>
             <from-view-id>/a.jsp</from-view-id>
             <navigation-case>
             <from-outcome>next</from-outcome>
             <to-view-id>/c.jsp</to-view-id>
             </navigation-case>
             </navigation-rule>
             <navigation-rule>
             <from-view-id>/b.jsp</from-view-id>
             <navigation-case>
             <from-outcome>next</from-outcome>
             <to-view-id>/c.jsp</to-view-id>
             </navigation-case>
             </navigation-rule>
            


            • 3. Re: problems with a4j:include
              maykellff

              Hi all, maybe the source of my problems can be the convination of jars i use, i mean myfaces api with tomahawks with ajax4jsf, can it be?


              Please any help will be very appreciated...

              • 4. Re: problems with a4j:include
                maykellff

                Hi all, ?why nobody answer me?

                Please, i need your help to solve this issue, i no doutbs that the solution is trivial but the fact is that the a4j:include is not working for me.

                ?There are some constraints to use the a4j:include? The docs not specify this.

                ?Can i use a4j:include in my old Exadel Studio projects?

                ?The a4j:include only work with xhtml pages?


                I have several doubts about this component and the documentation not clarify at all any of these.

                I hope you can help me.

                • 5. Re: problems with a4j:include
                  ilya_shaikovsky

                  1) a4j:include hasn't anything special in usage. Docs describes the usage. Main points - navigation rules returned by ajax controls will be processed only for included content.

                  2) You may freely use it in any projects.

                  3) It isn't important xhtml or jsp or jspx you use.

                  Why are you use so old MyFaces Tomahawk and RF environment, is it your requirements? There can be some problems connected with old myFaces versions,