5 Replies Latest reply on Aug 30, 2011 8:23 PM by konami.bankyaw.gmail.com

    Destroy (End) Conversation if the user leaving a specified page

    ralf

      Hello,


      i use h:outputLink without the propagation of the ConversationID.


      Now i hava a page, where the user can edit a Entity (with some ajax actions on the Bean which handles the entity) ... and, if he want to, navigate to another page (without saving the entity). In this case i assume, the user rejects the changes he made. But if the user visits the same entity again, the edited information (from the conversation before) are visible and were persisted.


      Is there any way to destroy (End) the existing conversation, if the user clicks a h:outputlink???


      I use PersistenceContext.EXTENDED.


      Thanks in advance,


      Ralf

        • 1. Re: Destroy (End) Conversation if the user leaving a specified page
          nille

          Hi,


          I have the same problem. Until now I used a combination of JavaScript and an action method to end an existing long running conversation. In my case, the long-running conversation should end if the user closes the browser window created by a



          <s:link target="_blank"...



          For that I used the onUnload event:


           <body id="pgReportMain" onUnload="destroyConversation();">
          



          and some lines of code down


          <a4j:jsFunction name="destroyConversation" action="#{myAction.endConversation()}"/>



          This calls the following action




          @End
           public void endConversation() {
               log.info("Ending conversation: " +  Manager.instance().getCurrentConversationId());
          }



          Unfortunately, this works fine for Firefox: I can click on the link, do some things in the popped up windows and close the window as often as I want without any problem (ok, I tried it for about 10 times). But I have a massive problem with the Internet Explorer. For IE this works exactly twice. After closing the popped up window for the second time, IE just does nothing. No respond to links, just nothing. I used fiddler2 (the web debugging proxy) and it seems that the IE does not even sends the (third) request.


          Does anybody has an idea?


          Kind regards,
          Nille

          • 2. Re: Destroy (End) Conversation if the user leaving a specified page
            amitev

            onunload don't seem to be a good solution. What if the desired page contains a postback form and i don't want to kill the conversation on postback?

            • 3. Re: Destroy (End) Conversation if the user leaving a specified page
              nille

              That's right. In my case it would be ok (if it would work with IE) because there is no postback form in it.

              • 4. Re: Destroy (End) Conversation if the user leaving a specified page
                kibojan

                I have the same problem... any new thoughts on this?

                • 5. Re: Destroy (End) Conversation if the user leaving a specified page
                  konami.bankyaw.gmail.com

                  May be you can start a new conversation every time you enter the page. I think you can achieve that with pages.xml. There are ways to force seam to start a new conversation for a particular page using pages.xml. I forgot the exact syntax.