2 Replies Latest reply on Sep 20, 2008 2:15 PM by Nick Belaevski

    integrating a4j:include with spring web flow

    soubhratra das Newbie

      Hi, I am trying to use richfaces with spring web flow but getting the following error.. Please find below the detail scenerio and relevant code fragments..experts, can you please comment on this error?

      Caused by: java.lang.IllegalArgumentException: groupWizardForm
       at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:620)
       at org.ajax4jsf.renderkit.RendererUtils.findComponentFor(RendererUtils.java:858)
       at org.ajax4jsf.context.AjaxContextImpl.convertId(AjaxContextImpl.java:621)
       at org.ajax4jsf.context.AjaxContextImpl.addRegionsFromComponent(AjaxContextImpl.java:591)
       at org.ajax4jsf.component.AjaxActionComponent.setupReRender(AjaxActionComponent.java:96)
       at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:60)
       at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:139)
       at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:317)
       at org.ajax4jsf.component.AjaxViewRoot.broadcastAjaxEvents(AjaxViewRoot.java:336)
       at org.ajax4jsf.application.AjaxViewHandler.processAjaxEvents(AjaxViewHandler.java:206)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:182)
       at org.springframework.faces.webflow.JsfView.render(JsfView.java:92)
       at org.springframework.webflow.engine.ViewState.render(ViewState.java:257)
       at org.springframework.webflow.engine.ViewState.resume(ViewState.java:209)
       at org.springframework.webflow.engine.Flow.resume(Flow.java:551)
       at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:263)
       ... 43 more


      I am trying to implement a4j:include wizard with SWF flow but not able to get the rerender="#{flowRenderFragments}" work. Please help me to make this work.
      I have the main page with three tabs as start of the SWF flow. One tab has a a4j:include. On clicking the next button on this tab the next page of a4j:include and corrsponding spring flow should appear.

      Main page code..
      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:ui="http://java.sun.com/jsf/facelets">
      
       <head>
       <title>Oversight Administration </title>
       </head>
       <body>
       <f:view>
      
       <rich:tabPanel switchType="client" >
       <rich:tab label="Group Management" disabled="true">
       Default text - Group Management
       </rich:tab>
       <rich:tab label="MyGroup Preferences">
       <h:form id="groupWizardForm">
       <h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
       <rich:panel styleClass="wizard" id="groupWizardFragment" layout="none">
       <f:facet name="header">
       <h:outputText value="MyGroup Preferences" />
       </f:facet>
       <a4j:include viewId="myGroupBasicinfo.xhtml" />
       </rich:panel>
       </h:panelGrid>
       </h:form>
       </rich:tab>
       <rich:tab label="My Preferences">
       Default text - my Preferences
       </rich:tab>
       </rich:tabPanel>
       </f:view>
       </body>
       </html>


      source of a4j included page where I have next and save buttons with rerender="#{flowRenderFragments}" as per spring web flow convension.

      <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:200px">
       <h:panelGrid rowClasses="s1row" columns="3" columnClasses="wfcol1,wfcol2,wfcol3">
       <h:outputText value="Group name:" />
       <h:inputText id="shortName" value="#{oversightGroup.shortName}" required="true" />
       <rich:message for="shortName" />
      
       <h:outputText value="Public:" />
       <h:selectBooleanCheckbox id="publicFlag" value="#{oversightGroup.publicFlag}" required="false"/>
       <rich:message for="publicFlag" />
      
       <h:outputText value="Description" />
       <h:inputTextarea id="description" value="#{oversightGroup.description}" rows="5" cols="15" required="false"/>
       <rich:message for="description"/>
       </h:panelGrid>
       <div class="navPanel">
       <a4j:commandButton style="float:left" action="next" value="Next &gt;&gt;" reRender="#{flowRenderFragments}"/>
       <a4j:commandButton style="float:right" action="save" value="Save" reRender="#{flowRenderFragments}"/>
       </div>
       </div>
      </ui:composition>


      Here is my flow definition ..

      <view-state id="adminPanel">
       <transition on="next">
       <render fragments="groupWizardForm:groupWizardFragment" />
       </transition>
       <transition on="save">
       <render fragments="groupWizardForm:groupWizardFragment" />
       </transition>
       </view-state>
      
      
       <view-state id="myGroupBasicInfo" view="myGroupBasicInfo.xhtml">
       <transition on="next" >
       <render fragments="groupWizardForm:groupWizardFragment" />
       </transition>
       <transition on="save">
       <render fragments="groupWizardForm:groupWizardFragment" />
       </transition>
       </view-state>
      --------


      It seems to me that it is a a4j rendering issue. Can somebody please help me out?