2 Replies Latest reply on Aug 7, 2007 11:41 AM by Eric Chang

    help with ending conversations in a pageflow

    Eric Chang Newbie

      hello,

      i've recently started using jPDL pageflows in Seam 1.2.1.GA and have gone by the book in ending a pageflow:

      <page name="recommendation-complete" view-id="/recommendations/complete.xhtml">
       <redirect/>
       <transition name="overview" to="rec-overview"/>
       </page>
      
       <page name="rec-overview" view-id="/recommendations/recoverview.xhtml">
       <redirect/>
       <end-conversation before-redirect="true"/>
       </page>


      i want to end the conversation before the redirect to recoverview.xhtml because that page has a backing stateful session bean that has a starts a conversation on page load via a @Begin(join=true) annotation in it's init() method.

      however, i'm finding that since the schema requires that <end-conversation> element has to come after the , recoverview.xhtml is being loaded with the pageflow's long-running conversation still active. a browser refresh does clear out this conversation state.

      i can get this to work if i explicitly call a method annotated with @End(beforeRedirect=true) _before_ making the transition in the pageflow:
       <page name="recommendation-complete" view-id="/recommendations/complete.xhtml">
       <redirect/>
       <transition name="overview" to="rec-overview">
       <!-- method below is annotated @End(beforeRedirect=true)-->
       <action expression="#{myBean.endConversation}"/>
       </transition>
       </page>
      
       <page name="rec-overview" view-id="/recommendations/recoverview.xhtml">
       <redirect/>
       </page>


      in this case, the long-running conversation associated with the pageflow ends before recoverview.xhtml is loaded, which is the intended behavior.

      however, the approach above is less than desirable because it requires me to make the call to #{myBean.endConversation} on all applicable transitions rather than encapsulating it in the pages that I have designated as end states. is there another way to accomplish this and/or am I misusing conversations by mixing pageflows that redirect to pages that themselves are associated with (new) conversations?

        • 1. Re: help with ending conversations in a pageflow
          Eric Chang Newbie

          sorry, i meant to say:

          "however, i'm finding that since the schema requires that <end-conversation> element has to come after the redirect, recoverview.xhtml is being loaded with the pageflow's long-running conversation still active. a browser refresh does clear out this conversation state."

          • 2. Re: help with ending conversations in a pageflow
            Eric Chang Newbie

            my co-worker suggested a solution that works and gets around the problem of having to add calls to the @End-annotated method on every transition. This solution uses the event node with a type of "node-enter" to invoke the @End-annotated method prior to the page redirect.

             <page name="recommendation-complete" view-id="/recommendations/complete.xhtml">
             <redirect/>
             <transition name="overview" to="rec-overview"/>
             </page>
            
             <page name="rec-overview" view-id="/recommendations/recoverview.xhtml">
             <redirect/>
             <event type="node-enter">
             <!-- method below is annotated @End(beforeRedirect=true)-->
             <action expression="#{myBean.endConversation}"/>
             </transition>
             </event>
             </page>