2 Replies Latest reply on May 25, 2007 7:04 AM by cdanielw

    Unable to stop conversation propagation for <s:link action=?

    cdanielw

      An <s:link/>, where the navigation is defined by the action attribute, propagates the conversation event though the propagation attribute is set to none, a <s:conversationPropagation propagation="none"/> is added to the tag body or a <f:param name="conversationPropagation" value="none"/> is added to the tag body.

      I opened an issue for this (http://jira.jboss.com/jira/browse/JBSEAM-1162?page=all), but it was closed. Since this is not a bug, the only way I can see it is that the documentation fails to mention this limitation. Am I missing something obvious?

      Below is an extended test case, which should cover most cases.

      1) Pointing your browser to test1 begins (or joins) a conversation.

      2) Clicking on one of the links navigates to test2, hopefully without propagating the conversation. Whether the conversation was propagated or not is what we actually want to test

      3) In test2, clicking on the link starts a new conversation and navigates back to test1. Starting the new conversation will fail if we propagated the conversation from test1.

      The links colored red propagates the conversation, while the green ones don?t. All <s:link action=?xxx?/> propagates the conversation. <s:link view=?xxx?/> and <h:commandLink/> doesn?t.


      test1.xhtml

      <?xml version='1.0' encoding='UTF-8'?>
      <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">
      <head></head>
      <body>
      <h:form>
      
       <h:panelGrid columns="1">
       <s:div>Using s:link - only the ones using the "view" attribute actually stops the conversation propagation:</s:div>
       <s:link value="1" view="/test2.xhtml" propagation="none" style="color: green;"/>
      
       <s:link value="2" action="/test2.xhtml" propagation="none" style="color: red;"/>
      
       <s:link value="3" action="toTest2" propagation="none" style="color: red;"/>
      
       <s:link value="4" action="#{someComponent.doSomething}" propagation="none" style="color: red;"/>
      
       <s:link value="5" view="/test2.xhtml" style="color: green;">
       <s:conversationPropagation propagation="none"/>
       </s:link>
      
       <s:link value="6" action="/test2.xhtml" style="color: red;">
       <s:conversationPropagation propagation="none"/>
       </s:link>
      
       <s:link value="7" action="toTest2" style="color: red;">
       <s:conversationPropagation propagation="none"/>
       </s:link>
      
       <s:link value="8" action="#{someComponent.doSomething}" style="color: red;">
       <s:conversationPropagation propagation="none"/>
       </s:link>
      
       <s:link value="9" view="/test2.xhtml" style="color: green;">
       <f:param name="conversationPropagation" value="none"/>
       </s:link>
      
       <s:link value="10" action="/test2.xhtml" style="color: red;">
       <f:param name="conversationPropagation" value="none"/>
       </s:link>
      
       <s:link value="11" action="toTest2" style="color: red;">
       <f:param name="conversationPropagation" value="none"/>
       </s:link>
      
       <s:link value="12" action="#{someComponent.doSomething}" style="color: red;">
       <f:param name="conversationPropagation" value="none"/>
       </s:link>
      
       <s:div>Using commandLink:</s:div>
      
       <h:commandLink value="13" action="/test2.xhtml" style="color: green;">
       <s:conversationPropagation propagation="none"/>
       </h:commandLink>
      
       <h:commandLink value="14" action="toTest2" style="color: green;">
       <s:conversationPropagation propagation="none"/>
       </h:commandLink>
      
       <h:commandLink value="15" action="#{someComponent.doSomething}" style="color: green;">
       <s:conversationPropagation propagation="none"/>
       </h:commandLink>
      
       <h:commandLink value="16" action="/test2.xhtml" style="color: green;">
       <f:param name="conversationPropagation" value="none"/>
       </h:commandLink>
      
       <h:commandLink value="17" action="toTest2" style="color: green;">
       <f:param name="conversationPropagation" value="none"/>
       </h:commandLink>
      
       <h:commandLink value="18" action="#{someComponent.doSomething}" style="color: green;">
       <f:param name="conversationPropagation" value="none"/>
       </h:commandLink>
      
       <s:div>Using commandLink and not ending propagation - should definitely fail:</s:div>
      
       <h:commandLink value="19" action="/test2.xhtml" style="color: red;"/>
      
       <h:commandLink value="20" action="toTest2" style="color: red;"/>
      
       <h:commandLink value="21" action="#{someComponent.doSomething}" style="color: red;"/>
       </h:panelGrid>
      
      </h:form>
      </body>
      </html>
      


      test2.xhtml
      <?xml version='1.0' encoding='UTF-8'?>
      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html">
      <head></head>
      <body>
      <h:form>
       <h:commandLink value="To test 1" action="toTest1"/>
      </h:form>
      </body>
      </html>
      


      SomeComponent.java
      import org.jboss.seam.annotations.Name;
      
      @Name("someComponent")
      public class SomeComponent {
       public String doSomething() {
       System.out.println("Something done!");
       return "toTest2";
       }
      }
      
      


      The relevant parts from pages.xml
       <page view-id="/test1.xhtml" >
       <begin-conversation join="true"/>
       <navigation>
       <rule if-outcome="toTest2">
       <redirect view-id="/test2.xhtml"/>
       </rule>
       </navigation>
       </page>
      
       <page view-id="/test2.xhtml">
       <navigation>
       <rule if-outcome="toTest1">
       <begin-conversation/>
       <redirect view-id="/test1.xhtml"/>
       </rule>
       </navigation>
       </page>