myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Huemer <bernhard.hue...@gmail.com>
Subject Re: Events are fired twice for unknown reasons
Date Mon, 03 Sep 2007 15:45:11 GMT
Hello,

You could use Facelets as it doesn't use the JSP TagHandler classes of 
MyFaces, though I haven't tried yet. At least I can't remember facing 
this issue when using Facelets. By the way, here is the bug report: 
http://issues.apache.org/jira/browse/MYFACES-1712

regards,
Bernhard

Fan Shao wrote:
> Thanks Bernhard,
>
> from a user's view, what's the impact to JSF applications of this issue? And
> in what cases this problem can be reproduced? Is there anyway that I can
> mitigate it if brings about any problem before this issue is fixed? 
>
>
>
> Fan
>
>
>
> Bernhard Huemer-2 wrote:
>   
>> Hello,
>>
>> I've encountered the same problem recently and I've also figured out the 
>> reason. It's because the method setProperties() is called twice. Usually 
>> you wouldn't notice this behaviour as most properties just will be 
>> overridden but that's not the case for a ValueChangeListener (or an 
>> ActionListener). For a better understanding of this issue, I'll describe 
>> the call hierachy (somewhat simplified):
>>
>> ///
>> // 
>> myfaces/core/branches/1_2_1/api/javax/faces/webapp/UIComponentClassicTagBase.java
>>
>> protected UIComponent findComponent(FacesContext context)
>> {
>>         // ...
>>         // around line 1097
>>
>>         _componentInstance = findComponent(parent,id);
>>         if (_componentInstance == null)
>>         {
>>                 _componentInstance = createComponent(context, id);
>>                 _created = true;
>>                 setProperties(_componentInstance); // << here is the 
>> "first" call
>>                 // ....
>>
>> \\\
>>
>> ///
>> //
>> myfaces/core/branches/1_2_1/api/javax/faces/webapp/UIComponentELTag.java
>>
>> protected UIComponent createComponent(FacesContext context, String newId)
>> {
>>         // ...
>>         // around line 98
>>
>>         component.setId(newId);
>>         setProperties(component); // << her is the "second" call (it's 
>> actually the first, but it's the one I would omit)
>>
>>         return component;
>> }
>>
>> \\\
>>
>> I'll create a JIRA issue (including the appropriate patch) in a few 
>> hours, or maybe anyone else might be taking a look in the meantime.
>>
>> regards,
>> Bernhard
>>
>> Fan Shao wrote:
>>     
>>> Hi, 
>>>
>>> When trying to trace down the problem I posted a few days ago
>>> (http://www.nabble.com/Button-must-be-clicked-once-before-it-could-actually-do-something-tf4297733.html#a12234990)
>>> I found some of the events are fired twice, where they are supposed to be
>>> fired only once.
>>>
>>> The screen contains a datatable, and a dropdown box. When the user
>>> selects a
>>> value of the dropdown box, the form is submitted using
>>> this.form.submit(),
>>> and the datatable is reloaded according to user's selection. Everytime
>>> the
>>> datatable is reloaded its associated handler is called twice.
>>>
>>> Anyone has any idea about this?
>>>
>>> Many thanks!
>>>
>>> Fan
>>>       


Mime
View raw message