3 Replies Latest reply on Jan 6, 2007 12:08 AM by norman.richards

    start and kill a conversation



      <?xml version="1.0"?>
       xmlns="http://www.w3.org/1999/xhtml" version="2.0">
       <h:outputText value="#{conversation.id}"/>
       <div>id: <h:outputText value="#{myFather.id}" /></div>
       <div>managed: <h:outputText value="#{FatherHome.managed}" /></div>
       <div>name: <h:inputText value="#{myFather.name}" /></div>
       <s:button action="#{conversation.begin}" value="begin conv"/>
       <h:commandLink action="#{FatherHome.persist}" value="create" >
       <s:conversationPropagation type="begin"/>
       <h:commandLink action="#{FatherHome.update}" value="update" >
       <!--<s:conversationPropagation type="begin"/>-->
       <s:link view="/common/child.seam" value="child">

      That's the code of my page, i cant understand why clicking the first commandLink the conversation does not sart. Obviusly clicking the first button everything goes fine.

      I have another problem, i need to kill the active conversation when a click a link on a dataTable, invoke a bean's method wich has to start a new conversation and inject objects.
      I procedeed this way:
      1 - the s:link in the table's row have propagation="end"
      2 - the invoked method has @Begin annotation
      3 - the method body gets the conversation context and pushes objects into.

      The conversation ends an starts againg, with the same id, but the behaviour it's not the one i was expecting for.
      Is the conversation started just when leaving the @Begin annotated method? If this is true i'm pushing objects into a zombie conv...

      What's the best way to solve this issue?


        • 1. Re: start and kill a conversation

          I have no idea why the commandLink doesn't work. Perhaps it is because of something happening in the persist method?

          @Begin and @End do not really begin and end conversations themselves - they mark the current conversation as being long running or not long running, and Seam makes use of this information at the end of the request. Does that make the behavior you are observing more understandable?

          • 2. Re: start and kill a conversation

            Thanks, it clarifies a lot.
            So the only way to implement what i need is to explicitly create a new onversation within the method body, is it correct?

            does the following link code begin a conversation before the select method of searchResults component is called?

            <s:link action="#{searchResults.select}" view="/details.seam" propagation="begin"/>


            • 3. Re: start and kill a conversation

              A conversation is ALWAYS begun, no matter what you do. The only thing that @Begin does is mark it as a long running conversation, one that Seam will keep around between requests.

              To accomplish what you are after, you need to end the conversation and either redirect to a new page that starts a new conversation or else just begin a new conversation on the next click.