2 Replies Latest reply on Apr 30, 2009 10:18 AM by swenvogel

    Ending conversation on page change

    swenvogel

      Hi,


      it is possible to execute a action when the page change's (so the opposite of the page action),
      or end the current conversation?


      I have simple CRUD page's in conversation scope starting with a dataTable for selection.
      The user can choose differen action's like edit, delete, etc. and can also close the
      CRUD pages which also end the current conversation.


      But when the user navigates to a different page without using the close button
      the current conversation not end's.


      For example over the main navigation bar.



      Thanks...

        • 1. Re: Ending conversation on page change
          gonorrhea

          use <s:link propagation="end">


          s:link does not submit the form.


          another example to end conversation after an action method:


          <page view-id="/coursewizard/*">
          <navigation>
          <rule if-outcome="cancel">
          <end-conversation/>
          <redirect view-id="/FacilityList.xhtml"/>
          </rule>
          </navigation>
          </page>



          or:


          <page view-id="/coursewizard/*">
          <navigation from-action="#{courseWizard.save}">
          <rule if-outcome="success">
          <end-conversation/>
          <redirect view-id="/coursewizard/summary.xhtml"/>
          </rule>
          </navigation>
          </page>



          @End public String save() {
          try {
          ...
          entityManager.persist(course);
          FacesMessages.instance().add(
          "#{course.name} has been added to the directory.");
          return "success";
          } catch (Exception e) {
          FacesMessages.instance().add("Saving the course failed.");
          return null;
          }
          }



          So when evaluating the outcome via the <rule> tag, the Seam component method must return a String.

          • 2. Re: Ending conversation on page change
            swenvogel

            Thanks for your answer,


            now i hava added


            propagation="end"



            to all links in my main navigationand sub navigation and the conversation's are closed.
            The lasts problem is that when the user uses the browser back button, the conversation is not closed.


            I don't now wheter this is really a problem. Everything works fine except for that it could be happen that i end up with a lot of unused conversation's, depending wheter the user uses the browser back or not.