1 Reply Latest reply on Dec 7, 2008 6:39 PM by edwardiv

    <a4j:include> not working

    edwardiv

      Hi, I can't get a4j:include working. The first page includes fine, but clicking on the "Next" button doesn't update the page, although it does submit the form. I have updated my faces-config.xml as per the examples in the richfaces docs.

      A difference is that I'm using the include tag directly in my jsp/jsf pages instead of xhtml with <ui:component>.

      Code:

      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


      ...


      <f:view>

      <h:panelGroup id="wizard">
      <h:form id="register">
      <h:messages />
      <a4j:include id="incl" viewId="register1.jsp" />
      </h:form>
      </h:panelGroup>

      </f:view>



      The file "register1.jsp" gets included fine; here are the contents of register1.jsp:

      <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

      <rich:panel>
      <h:panelGrid columns="2">
      * First Name <h:inputText id="newusername" value="#{mybean.firstName}" />
      </h:panelGrid>
      <a4j:commandButton action="CORP" value="Next" reRender="wizard"/>
      </rich:panel>


      Pressing the "Next" button here submits the form, but the page doesn't go to the next one.

      Here's part of the faces-config.sml:

      <navigation-rule>
      <display-name>register1</display-name>
      <from-view-id>/register1.jsp</from-view-id>
      <navigation-case>
      <from-outcome>CORP</from-outcome>
      <to-view-id>/registercorp.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>

      Any help greatly appreciated.
      Thanks

        • 1. Re: <a4j:include> not working
          edwardiv

          It's ok - I figured out the problem.
          In the <a4j:include> tage, viewId=register1.jsp should have been viewId=/register1.jsp instead because that's how it's specified in the faces-config.xml

          Works fine now.