1 Reply Latest reply on Nov 26, 2006 1:54 PM by Ning Zhao

    [DVD example] how to directly go back to the checkout page a

    Ning Zhao Apprentice

      I'm trying to do this based on the DVD example version 1.1.0 CR 1: A new user comes in and chooses a lot of DVDs. The checkout was blocked since he hasn't logged in yet. Now he starts registration and hopefully after the "registration succeeded!" confirmation he can go directly back to the checkout page.

      In the current code, both the newuser and checkout conversations are already marked as nested. After the registration during checkout, the user would be directed to homepage but not the checkout page. The DVDs chosen before are still there though. But directly go back to checkout page would be less confusing to a new shopper. How many possibilities to achieve this with Seam?

      By the way, the current signature of the saveUser() in the EditCustomer.java is

      public String saveUser()
      . I guess it could also be
      public void saveUser()
      since the pageflow for registration is managed by the jpdl configuration but not the navigation.xml. There is no
      <from-outcome>success</from-outcome>
      entry in the navigation.xml. So
      return "success"
      in the try block has no effect.

        • 1. Re: [DVD example] how to directly go back to the checkout pa
          Ning Zhao Apprentice

          Just Got it with two pageflow definition files. :-) (the names of the transition nodes and view ids are modified according to the requirement of my application. But the idea is not difficult to capture...

          the boomBookingFlow.jpdl.xml:

          <?xml version="1.0" encoding="UTF-8"?>
          
          <pageflow-definition name="roomBookingFlow">
           <start-state name="start">
           <transition to="preference" />
           </start-state>
          
           <page name="preference" view-id="/reservations/preferences.xhtml">
           <redirect />
           <transition name="pricing" to="checkAvailability">
           <action expression="#{roomBooking.doPricing}" />
           </transition>
           <transition name="cancel" to="cancelPage" />
           </page>
          
           <decision name="checkAvailability"
           expression="#{roomBooking.roomAvailable}">
           <transition name="true" to="payment" />
           <transition name="false" to="preference" />
           </decision>
          
           <page name="payment" view-id="/reservations/payment.xhtml"
           no-conversation-view-id="/reservations/preferences.xhtml">
           <redirect />
           <transition name="next" to="checkLoggedIn" />
           <transition name="back" to="preference" />
           <transition name="cancel" to="cancelPage" />
           </page>
          
           <decision name="checkLoggedIn" expression="#{login.loggedIn}">
           <transition name="true" to="checkPayment" />
           <transition name="false" to="loginPage" />
           </decision>
          
           <page name="loginPage" view-id="/login.xhtml">
           <transition name="login" to="checkLoggedIn">
           <action expression="#{login.login}" />
           </transition>
           <transition name="newguest" to="registerConversation">
           <action expression="#{register.startEdit}" />
           </transition>
           <transition name="continue" to="checkPayment" />
           <transition name="back" to="payment" />
           <transition name="cancel" to="cancelPage" />
           </page>
          
           <page name="registerConversation" view-id="/register/account.xhtml" />
          
          
           <decision name="checkPayment"
           expression="#{roomBooking.validPayment}">
           <transition name="true" to="review" />
           <transition name="false" to="payment" />
           </decision>
          
           <page name="review" view-id="/reservations/review-details.xhtml"
           no-conversation-view-id="/reservations/preferences.xhtml">
           <redirect />
           <transition name="book" to="confirmation">
           <action expression="#{roomBooking.bookRoom}" />
           </transition>
           <transition name="back" to="payment" />
           <transition name="cancel" to="cancelPage" />
           </page>
          
           <page name="confirmation" view-id="/reservations/complete.xhtml"
           no-conversation-view-id="/reservations/preferences.xhtml">
           <redirect />
           <end-conversation />
           </page>
          
           <page name="cancelPage" view-id="/home.xhtml"
           no-conversation-view-id="/home.xhtml">
           <redirect />
           <end-conversation />
           </page>
          
          </pageflow-definition>
          


          the register.jpdl.xml:
          <pageflow-definition name="newguest">
           <start-state name="start">
           <transition to="account" />
           </start-state>
          
           <page name="account" view-id="/register/account.xhtml">
           <redirect />
           <transition name="next" to="checkPassword" />
           </page>
          
           <decision name="checkPassword"
           expression="#{register.validNamePassword}">
           <transition name="true" to="detail" />
           <transition name="false" to="account" />
           </decision>
          
          
           <page name="detail" view-id="/register/detail.xhtml"
           no-conversation-view-id="/register/account.xhtml">
           <redirect />
           <transition name="prev" to="account" />
           <transition name="next" to="confirmation" />
           </page>
          
           <page name="confirmation" view-id="/register/confirmation.xhtml"
           no-conversation-view-id="/register/account.xhtml">
           <redirect />
           <transition name="edit" to="detail" />
           <transition name="confirm" to="complete">
           <action expression="#{register.saveUser}" />
           </transition>
          
           </page>
          
           <page name="complete" view-id="/register/complete.xhtml"
           no-conversation-view-id="/register/account.xhtml">
           <redirect />
           <end-conversation />
           </page>
          
          </pageflow-definition>
          
          


          the diagrams are here:

          The room booking flow:

          [img]http://www.ningning.org/gallery/main.php/d/28-2/roomBooking-pageflow.png[/img]

          The register flow

          [img]http://www.ningning.org/gallery/main.php/d/26-2/register-pageflow.png[/img]

          Here the register conversation is a nested conversation of the room booking conversation.