3 Replies Latest reply on May 13, 2008 7:03 PM by wark2007

    Ending or destroying a conversation

      How can I make sure that a converstaion will be ended or destroyed? For example: The user selects a record in a datamodel and the selected row object will be stored in a conversation (the selectRow action is annotated with @Begin). Now, the user will be redirected to a new page wich represents the object attributs and the user can change them. If he clicks abort or save button a action ends the conversations (annoated with @End). Everything works as expected.


      But how can I end a conversation if the user just enters a new url in the adressbar of the browser or uses the back button? The objects in the conversation context still exist.

        • 1. Re: Ending or destroying a conversation
          andygibson.contact.andygibson.net

          I don't believe you can end a conversation if the user enters a new URL. You can't do anything if the user enters a URL since your site never receives notification that they are moving off the page (hence the whole need for session (and conversation) timeout).


          Cheers,


          Andy Gibson

          • 2. Re: Ending or destroying a conversation

            Thanks for your answer! I think I described my problem to short. I will give you a small example of what I want to do:


            The user opens a page which displays a list of employees (using @DataModel and @DataModelSelection). Now, the user wants to edit some details of an employee and clicks on a link in the specific row in the data table. The link invokes an action which is annotated with @Begin. The selected employee object/entity will be put in the conversation context and the user will be redirected to the page employeeDetails.xhtml.


            On that page all attributes and depending objects (maybe department, list of skills, etc.) will be displayed. The user can edit the attributes or a add skill. These save/update/add actions are not annotaed with @End since I don't know if the user wants to manipulate further information on that page. After he has finished with manipulating employee data he goes back to employee overview.



            Here comes the problem - if the user uses a link back to overview everything works fine (the action ends the conversation). But if the user uses the back button in the browser (and a lot of users do so), he comes also back to the employee overview but all stored objects still resides in the conversation context. I have the same problem as if I had used session scope.

            • 3. Re: Ending or destroying a conversation

              Addition: Sorry, my mistake! For the back button it works (of course). I does not work if the user selects the employee overview url from the adressbar in the browser. I guess since he did not have the conversation id available there, am I right? I think this problem is unsolvable.


              I am looking for a possibility to say: If the user browses to any page (in my seam webapp) which is not defined in a given pageflow, the conversation shall be destroyed.


              Simple pageflow:
              employeeOverview.xhtml transition to employeeDetails.xhtml


              If the user browses to any other page after employeeDetails.xhtml, the conversation shall be destroyed.