This content has been marked as final.
Show 3 replies
-
1. Re: 2 pages, 2 conversations
cinconnu Aug 28, 2008 11:50 AM (in response to cinconnu)Seems like that was an idiot question... I found something but it is not working since the conversation is the same
tab1.xhtml:
<s:link action="#{test2.goto2()}" value="tab 2" /> <h:outputText value="#{manager.instance().getCurrentConversationId()}" /> <h:outputText value="#{manager.instance().getCurrentConversationDescription()}" />
tab2.xhtml:
<s:link action="#{test1.goto1()}" value="tab 1" /> <h:outputText value="#{manager.instance().getCurrentConversationId()}" /> <h:outputText value="#{manager.instance().getCurrentConversationDescription()}" />
pages.xml:
<conversation name="ctab1" parameter-name="c1" parameter-value="1" /> <conversation name="ctab2" parameter-name="c2" parameter-value="2" /> <page view-id="/home.xhtml"> <navigation from-action="#{test1.goto1()}"> <begin-conversation join="true" conversation="ctab1" /> <redirect view-id="/conv/tab1.xhtml" /> </navigation> </page> <page view-id="/conv/tab1.xhtml" conversation="ctab1"> <description>Tab 1</description> <navigation from-action="#{test2.goto2()}"> <begin-conversation join="true" conversation="ctab2" /> <redirect view-id="/conv/tab2.xhtml" /> </navigation> </page> <page view-id="/conv/tab2.xhtml" conversation="ctab2"> <description>Tab 2</description> <navigation from-action="#{test1.goto1()}"> <begin-conversation join="true" conversation="ctab2" /> <redirect view-id="/conv/tab1.xhtml" /> </navigation> </page>
Test1.java:
@Name("test1") @Scope(ScopeType.CONVERSATION) public class Test1 { public void goto1() { System.out.println("------ Test1.goto1: " + this + "/" + Conversation.instance()); ConversationEntry entry = ConversationEntries.instance().getConversationEntry("ctab1:1"); System.out.println("ctab1:1 = " + entry); if (entry != null) { System.out.println("selecting ctab1:1"); entry.select(); } } }
Test2.java:
@Name("test2") @Scope(ScopeType.CONVERSATION) public class Test2 { public void goto2() { System.out.println("------ Test2.goto2: " + this + "/" + Conversation.instance()); ConversationEntry entry = ConversationEntries.instance().getConversationEntry("ctab2:2"); System.out.println("ctab2:2 = " + entry); if (entry != null) { System.out.println("selecting ctab2:2"); entry.select(); } } }
on tab1, i got:
- cID:ctab1:1
- cDesc:Tab 1
and on tab2:
- cID:ctab2:2
- cDesc:Tab 2
but
ConversationEntries.instance().getConversationEntry("ctab1:1")
and
ConversationEntries.instance().getConversationEntry("ctab2:2")
return both the same entry...
How to have 2 different conversations ???
Thanks -
2. Re: 2 pages, 2 conversations
cinconnu Aug 28, 2008 2:36 PM (in response to cinconnu)Well i finally found some way to make it work...
Add propagation=none on the link:
<s:link action="#{test2.goto2()}" value="tab 2" propagation="none"/>
put a begin-conversation in the navigation rule and without join=true:
<page view-id="/conv/tab1.xhtml" conversation="ctab1"> <description>Tab 1</description> <navigation from-action="#{test2.goto2()}"> <begin-conversation /> <redirect view-id="/conv/tab2.xhtml" /> </navigation> </page>
so it works... until now...
-
3. Re: 2 pages, 2 conversations
cinconnu Aug 28, 2008 4:24 PM (in response to cinconnu)now has arrived. in fact the conversation is the same but the bean is destroyed and recreated each time.