conversation question - improvement suggestions with @Begin
holgerprause Jul 11, 2009 2:45 PMHello,
i like the idea of the conversation model and in fact its all working for me but i have some questions left.
One use-case i had problems with, is starting a long running conversation for each call of an action method.
That limit long runnnig conversation already active - try join=true
thing really is unneccesary and confusing in my opinion why not just start a new one? (should be the default beahaviour ill explain how i solved this problem)
lets look at this code
<a4j:commandLink id="selectMemberCommandLink" action="#{MultipleWindowTest.selectMember(member.id)}" value="--SELECT A MEMBER" oncomplete="taskBar.createWindow();" reRender="memberPanel,popupWindowPanel" limitToList="true" ajaxSingle="true" eventsQueue="popupQueue"> <s:conversationPropagation type="none"> </s:conversationPropagation> </a4j:commandLink>
<s:conversationPropagation type="none"> </s:conversationPropagation>
tells seam that the conversation shouldnt be propagated which means a new one can started without any problems
(becourse for the action method no conversation is existent)
That works fine - but theres 1 big problem with this solution- what if your action method needs values from the current active conversation?.
action="#{MultipleWindowTest.selectMember(member.id)}"
member.id wil resolve to null and the action method wil get 0
as imput parameter - doh!
The only solution i found was removing the conversationPropagation tag and hacking
this in my action method
Conversation.instance().leave(); //avoid "long running conversation already active stuff" Conversation.instance().begin();
//start a new one
So why i cant archieve the behaviour descriped above(just start a new long running conversation regardless what)
with annotations / pages.xml but only from java code?
@Begin join=false nested=false
should do the job from my understanding.
Well i could maybe write an annotation doing the 2 lines of code above but is this really necesary?
Any comment on this would be very helpfull!
Anyway its working now and all is fine - theres only a bitter taste left and it really dont understand why its so complicated to start a conversation.