3 Replies Latest reply on Jan 4, 2007 12:48 PM by Richard Leherpeur

    About pageflow

    Richard Leherpeur Novice

      Hello,

      I ran into some trouble trying to start properly a pageflow.

      First of all, let me explain the situation. I'm using JBoss 4.0.4GA with Seam 1.1.0GA

      I have a SFSB that is responsible for choosing a flow and start it.

      @Begin
      public void init() {
       ...
       Pageflow.instance().begin(this.getPageflow());
      }
      


      The pageflow is defined as followed:

      <?xml version="1.0"?>
      
      <pageflow-definition name="test">
      
       <start-page name="start">
       <transition to="isUserLoggedIn"/>
       </start-page>
      
       <decision name="isUserLoggedIn" expression="#{loginAction.isUserLoggedIn}">
       <transition name="true" to="page1" />
       <transition name="false" to="page2" />
       </decision>
      ...
      </pageflow-definition>
      


      The flow is started in the RENDER_RESPONSE phase, so I can't use <start-state>
      The issue I had is that the flow didn't start properly (I was redirected to an error page) but could not see anything wrong in the logs.

      So I looked into the code, more exactly at the begin method of Pageflow.java.

      public void begin(String pageflowDefinitionName)
      {
       if ( log.isDebugEnabled() )
       {
       log.debug("beginning pageflow: " + pageflowDefinitionName);
       }
      
       processInstance = PageflowHelper.newPageflowInstance( getPageflowProcessDefinition(pageflowDefinitionName) );
      
       //if ( Lifecycle.getPhaseId().equals(PhaseId.RENDER_RESPONSE) )
       //{
       //if a pageflow starts during the render response phase
       //(as a result of a @Create method), we know the navigation
       //handler will not get called, so we should force the
       //pageflow out of the start state immediately
       //TODO: this is not actually completely true, what about <s:actionLink/>
       //pi.signal();
       //}
      
       setDirty();
      
       Events.instance().raiseEvent("org.jboss.seam.beginPageflow." + pageflowDefinitionName);
      
       storePageflowToViewRootIfNecessary();
      
      }
      


      There is a comment about what I believe is my case. I then solved the problem by adding the following line at the end of the SFSB init method:

      Pageflow.instance().navigate(facesContext, null);
      


      Now everything is fine but I believe this should be fixed in Seam. It seems to me that you guys know about it already, so any plan yet?

      Regards,

      Richard