Conversation as a Subsession
sasha55 May 19, 2011 6:12 AMHello,
I have the following problem, 2 use cases, that should work in parallel
PageA working in separate conversation A
PageB and PageBView, working in separate conversation B
To implement such a behavior I use natural conversations with static ids, so that I always know that is the id of my conversation and can switch to it.
Pages.xml
<?xml version="1.0" encoding="UTF-8"?> <pages 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.2.xsd"> <conversation name="conversationA" parameter-name="convId" parameter-value="conversationA" /> <conversation name="conversationB" parameter-name="convId" parameter-value="conversationB" /> <page view-id="/pageA.xhtml" conversation="conversationA"> <description>pageA</description> <begin-conversation join="true" /> <navigation from-action="#{manager.beginA}"> <redirect view-id="/pageA.xhtml"> </redirect> </navigation> <navigation from-action="#{manager.beginB}"> <redirect view-id="/pageB.xhtml"> <param name="conversationPropagation" value="none" /> </redirect> </navigation> </page> <page view-id="/pageB.xhtml" conversation="conversationB"> <description>pageB</description> <begin-conversation join="true" /> <navigation from-action="#{manager.beginA}"> <redirect view-id="/pageA.xhtml"> <param name="conversationPropagation" value="none" /> </redirect> </navigation> <navigation from-action="#{manager.beginB}"> <redirect view-id="/pageB.xhtml"> <param name="conversationPropagation" value="none" /> </redirect> </navigation> <navigation from-action="#{manager.pageBViewNameA}"> <redirect view-id="/pageBView.xhtml"> </redirect> </navigation> <navigation from-action="#{manager.pageBViewNameB}"> <redirect view-id="/pageBView.xhtml"> </redirect> </navigation> </page> <page view-id="/pageBView.xhtml" conversation-required="true" no-conversation-view-id="/pageB.xhtml" conversation="conversationB"> <description>pageBView</description> <begin-conversation join="true" /> <navigation from-action="#{manager.beginA}"> <redirect view-id="/pageA.xhtml"> <param name="conversationPropagation" value="none" /> </redirect> </navigation> <navigation from-action="#{manager.beginB}"> <redirect view-id="/pageB.xhtml"> </redirect> </navigation> </page> </pages>
And menu to switch between pages and conversations looks like this,
<h:panelGrid title="Menu"> <h:outputLink value="pageA.jsf"> <f:param name="convId" value="conversationA" /> <h:outputText value="PageA" /> </h:outputLink> <h:outputLink value="pageB.jsf"> <f:param name="convId" value="conversationB" /> <h:outputText value="PageB" /> </h:outputLink> <h:commandBut
The only problem in this approach is that I have to use h:outputLink
to simulate conversation switch.
Is there a better solution for this problem?