5 Replies Latest reply on Apr 25, 2008 2:21 PM by pmuir

    can't restore parent conversation without redirect


      after invoking an action method marked with @End within a nested conversation the parent one is not restored.
      Forcing the  action method to redirect even to the same page with the beforeRedirect attribute, the stuff works.
      that's the use case:

      page :

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:rich="http://richfaces.org/rich" >
           <title>test </title>
                <h1>test started at : #{currentTime}</h1>
                     <h:form >
                          <h:outputText value=" #{currentTime} - id=#{conversation.id} - longRunning=#{conversation.longRunning} - nested=#{conversation.nested}"/>
                          <h:commandLink ajaxRendered="false" rendered="#{!conversation.longRunning}"  value="start long running"  action="#{convTest.startLongRunning}" >
                          <h:commandLink  ajaxRendered="false" rendered="#{conversation.longRunning}"  value="end current"  action="#{convTest.endCurrent}">
                          <h:commandLink   rendered="#{!conversation.nested and conversation.longRunning}"  value="start nested"  action="#{convTest.startNested}">

      component :

      public class ConvTest {
           @Logger Log log;
           public void startLongRunning(){
           public void startNested(){
           public void endCurrent(){

      changing the end method in the following way makes everythig work :

           public String endCurrent(){
                return "/test.xhtml";

      what's wrong?


        • 1. Re: can't restore parent conversation without redirect

          Conversations by default are propagated across a redirect.  Ending a conversation simply demotes the conversation to temporary meaning it will, by default, be carried across the redirect.  By setting beforeRedirect to true, you are telling Seam to demote the conversation temporary and not to propagate the now temporary conversation across the redirect.  In your case with this setting the parent conversation would be active after the redirect occurs since, when using nested conversations, an @End pops the conversation stack resuming the parent.

          Hope that helps.

          • 2. Re: can't restore parent conversation without redirect

            i submit my real world use-case in order to let you know what's the problem i'm facing with.

            when the user clicks a certain button a listener annotated with


            is invoked and a component's instance is injected in the newly create conversation context.

            The following pages then check whether or not that instance is null  to conditionally render portions of the UI.
            The nested conversation ends when the user clicks a button invoking an action marked with


            after the end method has been called the nested conv get demoted to a not longrunning one but my object's instance is still there causing a not correct page rendering.

            What i'd expected was that after the click the parent conversation context was restored and the nested one completely disappeared.

            What i'm i missimg?

            • 3. Re: can't restore parent conversation without redirect

              Jacob explained the theory correctly - simply that the conversation is still there, but just temporary. So, use beforeRedirect=true
              if you need the behaviour you describe.

              • 4. Re: can't restore parent conversation without redirect

                even if the request is going to trigger the rendering of the same page? In my specific case that ending method is addressed by an ajax request.


                • 5. Re: can't restore parent conversation without redirect

                  No, you need to do a redirect, even if it is back to the same page. There is no way to get a totally new conversation on just a render.