You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Fischer (JIRA)" <de...@myfaces.apache.org> on 2007/10/12 11:52:50 UTC

[jira] Reopened: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

     [ https://issues.apache.org/jira/browse/MYFACES-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Fischer reopened MYFACES-1712:
-------------------------------------


Although the supplied patch solves the described problem, it violates the contract of UIComponentClassicTagBase.html#createComponent [1]. The spec says, the method should
<quote>
initialize the components id and other properties
</quote>
which it does not.
I'll attach a patch which solve this problem and respects the specs.

[1]http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentClassicTagBase.html#createComponent(javax.faces.context.FacesContext,%20java.lang.String)

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.