0 Replies Latest reply on Feb 27, 2009 8:49 PM by dan19460

    Nested Conversation - Return to Parent

    dan19460

      I know there are a lot of posts on nested conversations and I've looked through most of them.  However, I have narrowed one problem down to a simple, easy to reproduce example of bizarre (IMO) behavior.  Here goes...


      Here is a simple Outer.xhtml page to start a conversation:



      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html   xmlns="http://www.w3.org/1999/xhtml"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:s="http://jboss.com/products/seam/taglib">
      <body>
          <h3>Outer Page</h3>
          <s:link id="startNested"
                  view="/test/Inner.xhtml"
                  value="Start"
                  propagation="nest"/><br/>
      
          <h:outputText value="The conversation id: #{conversation.id}"/> <br/>
          <h:outputText value="The conversation description: #{conversation.description}"/> <br/>
          <h:outputText value="Is this conversation long running?: #{conversation.longRunning}"/> <br/>
          <h:outputText value="Is this conversation nested? #{conversation.nested}"/><br/>
      
          <h:outputText value="This should show ONLY if the conversation is nested"
                        rendered="#{conversation.nested}"/>
      
      </body>
      
      </html>
      



      There is a Outer.page.xml page as well:



      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
            login-required="false">
      
          <begin-conversation join="true"/>
          <description>Outer Conversation</description>
      
      
      </page>
      



      As you can see, the s:link in the Outer page starts a NESTED conversation.  Here is that page:



      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html   xmlns="http://www.w3.org/1999/xhtml"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:s="http://jboss.com/products/seam/taglib">
      <body>
          <h3>Inner Page</h3>
          <s:link id="endNested"
                  action="#{conversation.endAndRedirect}"
                  value="End"
                  propagation="end"
                  rendered="#{conversation.nested}"/> <br/>
      
          <h:outputText value="The conversation id: #{conversation.id}"/><br/>
          <h:outputText value="The conversation description: #{conversation.description}"/> <br/>
          <h:outputText value="Is this conversation long running?: #{conversation.longRunning}"/> <br/>
          <h:outputText value="Is this conversation nested? #{conversation.nested}"/><br/>
          <h:outputText value="The parent conversation id is : #{conversation.parentId}"/><br/>
      
          <h:outputText value="This should show ONLY if the conversation is nested"
                        rendered="#{conversation.nested}"/>
      
      </body>
      
      </html>
      



      And the Inner.page.xml:



      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
            login-required="false">
      
          <begin-conversation join="true"/>
          <description>Inner Conversation</description>
      
      </page>
      



      When you go to the Outer page you will see something like this:



      Outer Page
      Start
      The conversation id: 35
      The conversation description: Outer Conversation
      Is this conversation long running?: true
      Is this conversation nested? false
      



      Then clicking on the Start link...



      Inner Page
      End
      The conversation id: 36
      The conversation description: Inner Conversation
      Is this conversation long running?: true
      Is this conversation nested? true
      The parent conversation id is : 35
      This should show ONLY if the conversation is nested 
      



      Notice the parentId of 35.  Now, the End link does a endAndRedirect which correctly takes you back to the Outer page:



      Outer Page
      Start
      The conversation id: 36
      The conversation description: Outer Conversation
      Is this conversation long running?: false
      Is this conversation nested? true
      This should show ONLY if the conversation is nested 
      



      Hmmm.  You would expect the conversation id to be 35, not 36.  I thought we ended that by clicking the s:link endAndRedirect on the Inner page.  Why is it still showing the old cid?  Also, notice that it thinks the conversation is nested.  Why is this?  This creates a problem because, as you can see, the last line was only supposed to render if the conversation was nested. 


      This is REALLY confusing to me.  What am I doing wrong?  I can't think of a simpler example than this.


      Dan