myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: orchestra conversation problem with popup window
Date Tue, 14 Oct 2008 07:54:51 GMT
Moreno Cornaz schrieb:
> Hi everybody.
>
> I have two pages P1 and P2 each one associated with 'its own bean', 
> say Bean1 and Bean2, defined in the same conversation. In addition P1 
> has reference to another bean, say Bean1A that has it's own 
> conversation (all defined through Spring).
> P2 is opened form P1 as a popup window with the same conversation 
> context as P1. When I open P2, it happens that the Bean1A has been 
> lost and from P1
> its values are null.
> Why this happens? Bean1A has nothing to do with P2.
> I thought that when I open P2 I make a request that doesn't have any 
> reference to Bean1A and than orchestra deletes it, but why this 
> doesn't happen with the bean B1 too?
You must *not* have two windows with the same conversationContext value 
in the url.

The http protocol gives web servers absolutely no way of knowing which 
window a request comes from. So when two windows use the same 
conversationContext value, then window 1 asks for P1 and window 2 asks 
for P2 this looks to orchestra *exactly* the same as one window first 
asking for P1 then asking for P2.

So when opening a popup window, always avoid setting the 
conversationContext in the url for the new window; orchestra will then 
allocate a new conversationContext for the new window. Yes this means 
that two windows cannot share conversation-scoped beans but that is a 
*good* thing.

Orchestra provides the o:separateConversationContext tag that allows 
outputLink components to be generated without the automatic 
conversationContext being added. If you are using javascript to pop up 
the new window then you need to correctly handle the conversationContext 
param yourself. See the separateConversationContext tag here:
  
http://myfaces.apache.org/orchestra/myfaces-orchestra-core/tlddoc/index.html

The situation is somewhat different for *modal* windows; it does make 
some kind of sense for modal windows to be able to access *some* of the 
beans associated with the context. Orchestra is still young so "best 
practice" is still being invented at the moment, but I think the best 
way to handle modal popups is to still run the new window in a new 
conversation-context and to explicitly "copy" beans that need to be 
shared into the new context. The experimental Orchestra Flow project 
tries to provide an easy way to do this, but it isn't ready for 
production use yet.

Regards,
Simon



Mime
View raw message