2 Replies Latest reply on Jul 1, 2008 2:26 AM by limnin

    Urgent help required: a4j:include doesn't work at all, while

    limnin

      Hi, ALL.
      Could anyone help me with a4j:include?
      I'm trying to make the exadel live demo samples work, but has not succeed. The problem is that a4j:include doesn't work at all, while ui:include does and I don't know how could that be. Yes, does not working at all, it just gives me the damned empty span and that's it. If I put ui:include with src attribute same as viewId of ui:include - it renders fine. But, of course this is not the result I want.

      Here go two my facelets which are nearly same that demo code gives me (some dynamic properties from beans were excluded)

      test1.xhtml
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <style type="text/css">
       .col1 { vertical-align:top; }
       .col2 { vertical-align:top; width:450px; }
       .wform td { vertical-align:top; }
       .s1row td { height:30px; }
       .navPanel input[type="button"] {
       background-color: red;
       }
       </style>
      
       <rich:separator height="1" style="padding:10px"/>
       <h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
       <f:verbatim>
       The demo shows the example of three-steps wizard created
       using a4j:include. The navigation rules defined in the
       faces-config.xml are used to navigate between the steps
       of the wizard.
       </f:verbatim>
       <a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;" />
      
       <rich:panel styleClass="wizard">
       <f:facet name="header">
       <h:outputText value="Using a4j:include for Wizard-like behaviour" />
       </f:facet>
       <h:form id="form1">
       <a4j:include id="wizpage" viewId="/myroot/test2.xhtml" />
       </h:form>
       </rich:panel>
       </h:panelGrid>
       <rich:separator height="1" style="padding:10px"/>
      </ui:composition>
      
      test2.xhtml
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <div style="position:relative;height:140px">
       <h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
       <h:outputText value="First Name:" />
       <h:inputText id="fn" value="blah blah" label="First Name" required="true" />
       <rich:message for="fn" />
       <h:outputText value="Last Name:" />
       <h:inputText id="ln" value="ddd" label="Last Name" required="true" />
       <rich:message for="ln" />
       <h:outputText value="Company:" />
       <h:inputText id="comp" value="" label="Company" required="true" />
       <rich:message for="comp"/>
       </h:panelGrid>
      
       <div class="navPanel">
       <a4j:commandButton id="wizardNext" value="Next >>" style="float:right" action="next"/>
       </div>
       </div>
      </ui:composition>
      


      And my web.xml is
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">
       <!-- Use Documents Saved as *.xhtml -->
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <!-- Special Debug Output for Development -->
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>2</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <!-- Optional JSF-RI Parameters to Help Debug -->
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>true</param-value>
       </context-param>
      
      
      
       <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
       </context-param>
      
       <filter>
       <display-name>RichFaces Filter</display-name>
       <filter-name>richfaces</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
      
       <welcome-file-list >
       <welcome-file>index.jsp</welcome-file>
       </welcome-file-list>
      </web-app>


      and my faces-config.xml is here
      <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
       version="1.2">
      
       <application>
       <locale-config>
       <default-locale>en</default-locale>
       <supported-locale>ru_RU</supported-locale>
       </locale-config>
       <message-bundle>Messages</message-bundle>
       <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
       </application>
      </faces-config>


      I'm using JBoss 4.2.1.GA as application server, RichFaces 3.2.1, Sun JSF implementation 1.2 and Facelets 1.0.14.

      I've spent 3 days trying to solve this bloody problem perusing google search results, reading forums etc, but still stuck with it.

      Thanks in advance for any help.

        • 1. Re: Urgent help required: a4j:include doesn't work at all, w
          mail.micke

          Is test2.xhtml in the root of your web application?

          If it is (and not in a directory called myroot) try and remove the myroot bit of the path (/test2.xhtml).

          • 2. Re: Urgent help required: a4j:include doesn't work at all, w
            limnin

            Thanks a lot for your answer.

            Is test2.xhtml in the root of your web application?

            If it is (and not in a directory called myroot) try and remove the myroot bit of the path (/test2.xhtml).


            This doesn't help. The solution was found: it was complete change of JSF and RichFaces implementation. With help of MyFaces 1.1 instead of Sun implementation 1.2 and RichFaces 3.1.4 everything goes live. I wonder what exact library is responsible for this odd behavior, but now I don't have time to investigate. Maybe later I'll figure it out but now it's time to rush.