Simon,

This does also make no sense to me and therefore I asked this question ;-)
I did not see this problem in any project so far and all of my beans are 
working fine and living as expected.

The bean has session scope and the 2 instances are created in the same session. 
I don't use a custom VariableResolver and the bean is defined once. 
The onresize event is fired a few times in a very short time, maybe that is 
causing the problem...

I try to debug this further next week and if I have some free time I'll  create 
a small sample app with an ajax link and a normal link. 

Thanks
Michael

-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 22. Februar 2007 20:47
To: MyFaces Discussion
Subject: Re: session scoped Bean created twice!

Hi Michael,

What you're describing doesn't make any sense to me.

When an EL expression referencing this bean is evaluated and the bean is 
found not to exist in any scope then the object is created and a 
reference to it is placed into the http session. After that, any EL 
expression which references that object will retrieve it from the session.

This all works fine for me, and for everybody else in the world AFAIK.

I'm pretty sure that what you *think* is happening is *not* what is 
actually occurring. The options I see are:
* the bean is being created in DIFFERENT http sessions, as David suggested
* the bean isn't actually session-scope (maybe you have multiple 
definitions for the same name, or a custom VariableResolver that has a 
bug...)
* something is deleting it from the session after it is created

Regards,

Simon

Michael Heinen wrote:
> It is the same session id.
> I have absolutely no idea what's going wrong internally.
> 
> -----Original Message-----
> From: David Delbecq [mailto:[EMAIL PROTECTED] 
> Sent: Donnerstag, 22. Februar 2007 14:17
> To: MyFaces Discussion
> Subject: Re: session scoped Bean created twice!
> 
> Did you check that the session associated with those 2 session beans is
> the same? If the ajax component gets confused client side, it might be
> that it is handling in fact 2 different session, and the posting the
> resize event to each session.
> 
> En l'instant précis du 02/22/07 14:07, Michael Heinen s'exprimait en ces
> termes:
>> One of my session scoped beans is created two times.
>>
>>  
>>
>> I call an ajax actionListener (a4j:commandlink) via JS when the user
>> resizes the browser window.
>>
>> The onresize event of the documentBody is fired multiple times during
>> resizing.
>>
>> Therefore my actionListener is also called multiple times which is not a
>> problem because I just reset some values and don't refresh anything on
>> the screen.
>>
>>  
>>
>> But during debugging I noticed, that the session scoped bean of the
>> ActionListener is initialized twice with two different object ids.
>>
>> The ActionListeners are called for both instances of the Bean!!!
>>
>> What's the reason for that ?
>>
>>  
>>
>> When I resize the browser window a second time after the first resizing
>> finished
>>
>> then the ActionListener of the second created bean is executed only.
>>
>>  
>>
>> I use:
>>
>> MyFacesCore 1.1.4 
>>
>> tomahawk snapshot 1.1.4 
>>
>> a4j 1.0.6
>>
>>  
>>
>> Any help is appreciated
>>
>> Michael
>>
>>  
>>
>>  
>>
>>
>>   
> 
> 


Reply via email to