0 Replies Latest reply on Nov 6, 2007 5:25 AM by zerg-spirit

    Proper back buttoning again...

    zerg-spirit

      Hey,

      I currently have a problem regarding the back buttoning.
      Basically, I have a page to translate messages (as a matter of fact, it's my messages stored in database for my ResourceBundles).
      A message owns a list of expression, each representing a translation for the message for a given Language.

      The page displays a message and all its translations, and then the user push the next button to go to the next message, or the previous to come back to the previous one.

      I first had the problem that when a user was using the browser's back button, and translated some expression for the displayed message, it was actually fetching the change for the previously displayed message, as for the application the state hasn't changed.

      I then used jPDL page flow, defining a simple rule to avoid wrong states. Time for some code:

      The page-flow:

      <pageflow-definition name="auto-translate">
      
       <start-page name="TranslateItem" view-id="/admin/TranslateItem.xhtml">
       <redirect/>
       <transition name="next" to="TranslateItem">
       <action expression="#{autoTranslator.next()}" />
       </transition>
       <transition name="previous" to="TranslateItem">
       <action expression="#{autoTranslator.previous()}" />
       </transition>
       </start-page>
      
      </pageflow-definition>


      As stated, it's very simple. I have only one page, and 2 cases possible: previous and next. Those are working perfectly though.

      I added the little thingy to activate the back-button according to Seam Documentation. This is the code I think that might be wrong:

      <page view-id="/admin/TranslateItem.xhtml" back="enabled">
       <redirect/>
       <transition to="/admin/TranslateItem.xhtml"/>
       <transition name="previous" to="previous"/>
       </page>

      I'm not sure what I should put at the last line (transition name= ...).

      Basically, at the moment, when a user clicks on the back button, the application sends him back to the page before the conversation was started. So there's no more wrong states in the application, but the back-button is actually not enabled at all, since I thought the user might be able to come back to a previous state with this back button according to the Seam documentation (= to the previous message in my case).

      Thanks for your help.