Hi Gavin,
creating a specific test case it's been useful to better understand the Seam behaviour
when I try to create a conversation with a given id or remove a conversation and switch to
a different one. Ok, this is what I've seen:
1 - Conversation creation with a given ID: If I create a conversation with a given id
(@Begin(join=true, id="myId1")), Seam creates a conversation with the given
identifier, but if I have two (but I think also more than two) defined as follows:
|
| ActionOne.java:
|
| @Name("actionOne")
| @Scope(ScopeType.CONVERSATION)
| public class ActionOne {
|
| @Begin(join=true, id="actionone")
| public String startConversation() {
| .....
| return "one";
| }
| }
|
|
|
| ActionTwo.java:
|
| @Name("actionTwo")
| @Scope(ScopeType.CONVERSATION)
| public class ActionTwo {
|
| @Begin(join=true, id="actiontwo")
| public String startConversation() {
| .....
| return "two";
| }
| }
|
|
When I start the first conversation, say actionone, everything is ok, the conversation has
the given identifier; but when I start the second one the conversation identifier is the
same for both: the first one 'actionone', even if the two actions maintain
different view ids.
If I pass the conversation identifier as a <f:param> and the param name is other
than "conversationId" the conversation identifier is ignored.
If I pass a parameter named as conversationId in a <s:link> to start a conversation
with a static identifier defined in the @Begin annotation the identifier is completely
ignored and the conversation gets the value of the conversationId parameter.
As a recap:
I can create, correctly, only named conversations following these guidelines:
- The link to the conversation begin method must contain a parameter named
conversationId, for example:
| <s:link action="#{actionTwo.startConversation}">
| <h:outputText value="Start Conversation" />
| <f:param name="conversationId" value="<something static
or EL>" />
| </s:link>
|
- The conversation begin method must be defined as follows:
| @Name("actionOne")
| @Scope(ScopeType.CONVERSATION)
| public class ActionOne {
|
| @Begin(join=true, id="#{param.conversationId}")
| public String startConversation() {
| .....
| return "one";
| }
| }
|
Maybe I discovered the hot water... But I did not find all these rules to follow in the
documentation, but probably I did not read very well the documentation; so if there's
someone else like me... maybe he can loose less time than me to get the right way.
2 - Remove a conversation and switch to a different one: Conversation.instance().end()
works (but does not execute the @End method), removes the current conversation, but does
not do enough, indeed, in my application I need to switch to a different conversation in
order to show the tab content of the tab which reaches the focus after the tab remotion,
then I need to do this (or something equivalent):
| Conversation.instance().end();
| Manager.instance().switchConversation(focusedTabConversationId);
|
but this unfortunately does not work (as I would) and, more precisely, happens:
- if I call only the Conversation.instance().end() Seam does not switch to the
conversation of the tab which reaches the focus and then does not show the correct data,
moreover, in my situation the outcome of the tab removed and of the tab focused can be the
same (and in my tests were the same) with the effect that the screen is frozen with the
data I just removed;
- if I call both the methods Seam performs the conversation switch correctly and shows
the correct tab but does not perform any conversation remotion
an example of my scenario: I have a search tab, a user can search for something, when
finds what he needs selecting the related link opens a new tab with the detail and then
closes the search tab, if he needs to open again the search tab is to search something
else but everything he made before is already on the screen.
So, this is what I found... But I need a little of help to understand if I made something
wrong, if it's a known behaviour a bug.....
Regards,
Raffaele Camanzo
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025128#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...