2 Replies Latest reply on Sep 15, 2009 7:29 AM by JLuis -

    <a4j:include> example doesnt work ¿?

    JLuis - Newbie

      Following <a4j:include> example (taken from Practical RichFaces book) doesn't works for me.
      step1.jspx is correctly loaded inside mainpage.jspx, but navigation doesn't works.
      Several tries of my own didn't help. Could somebody help me with this?

      mainpage.jspx:

      ...
      <rich:panel style="width:400px">
       <f:facet name="header">
       <h:outputText id="step"
       value="Registration - Step #{registrationBean.step}"/>
       </f:facet>
       <h:panelGrid>
       <a4j:include viewId="/step1.jspx"/>
       </h:panelGrid>
      </rich:panel>
      ...
      


      step1.jspx:
      <h:form 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:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <h:panelGrid columns="2">
       <h:outputText value="First name:" />
       <h:inputText value="#{registrationBean.firstName}" />
       <h:outputText value="Last name:" />
       <h:inputText value="#{registrationBean.lastName}" />
       </h:panelGrid>
       <a4j:commandButton value="Continue" action="forward"
       actionListener="#{registrationBean.nextStep}" reRender="step" />
      </h:form>
      


      step2.jspx:
      <h:form 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:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <h:panelGrid columns="2">
       <h:outputText value="Email:" />
       <h:inputText value="#{registrationBean.email}" />
       </h:panelGrid>
       <a4j:commandButton value="Back"
       actionListener="#{registrationBean.prevStep}" action="back"
       reRender="step" />
       <rich:spacer width="5px" />
       <a4j:commandButton value="Continue"
       actionListener="#{registrationBean.nextStep}" action="forward"
       reRender="step" />
      </h:form>
      


      step3.jspx:
      <h:form 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:rich="http://richfaces.org/rich"
       xmlns:a4j="http://richfaces.org/a4j">
       <h:panelGrid columns="2">
       <h:outputText value="First name:" />
       <h:outputText value="#{registrationBean.firstName}" />
       <h:outputText value="Last name:" />
       <h:outputText value="#{registrationBean.lastName}" />
       <h:outputText value="Email:" />
       <h:outputText value="#{registrationBean.email}" />
       </h:panelGrid>
       <a4j:commandButton value="Back"
       actionListener="#{registrationBean.prevStep}" action="back"
       reRender="step" />
      </h:form>
      



      Navigation rules:
      <navigation-rule>
       <from-view-id>/step1.jspx</from-view-id>
       <navigation-case>
       <from-outcome>forward</from-outcome>
       <to-view-id>/step2.jspx</to-view-id>
       </navigation-case>
       </navigation-rule>
       <navigation-rule>
       <from-view-id>/step2.jspx</from-view-id>
       <navigation-case>
       <from-outcome>forward</from-outcome>
       <to-view-id>/step3.jspx</to-view-id>
       </navigation-case>
       <navigation-case>
       <from-outcome>back</from-outcome>
       <to-view-id>/step1.jspx</to-view-id>
       </navigation-case>
       </navigation-rule>
       <navigation-rule>
       <from-view-id>/step3.jspx</from-view-id>
       <navigation-case>
       <from-outcome>back</from-outcome>
       <to-view-id>/step2.jspx</to-view-id>
       </navigation-case>
       </navigation-rule>
      



      web.xml:

      ...
      <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.jspx</param-value>
      </context-param>
      ...
      <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jspx</url-pattern>
      </servlet-mapping>
      ...