HtmlDataList.processDecodes processes its children twice
--------------------------------------------------------

         Key: MYFACES-753
         URL: http://issues.apache.org/jira/browse/MYFACES-753
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.1.0, Nightly    
 Environment: MyFaces and Tomahawk 1.1.0 (and nightly build), Tiles
    Reporter: Nico Krijnen


When using commandLinks in a dataList, their action methods are executed twice. 
The problem seems to be caused by the processDecodes method in 
org.apache.myfaces.custom.datalist.HtmlDataList. This method processes the 
events for its children and then calls super.processDecodes, causing its 
superclass to process its children once more. This way two action events are 
queued.

When I comment out the call to super.processDecodes it all works as it should, 
but I am unsure whether that might have any side effects.
processUpdates and processValidators seem to have the same processing 
behaviour, I did not test them though, so I don't know if that causes any 
problems.

The bug occurs in the following setup:

<t:dataList id="orderTest"
        value="#{myBean.items}" var="item"
        layout="unorderedList">
        <h:column>
                <h:commandLink action="#{myBean.addItem}">
                        <h:outputText value="add within list" />
                </h:commandLink>
        </h:column>
</t:dataList>

With the following corresponding methods in my backing bean:

public void addItem() {
        SomeObject item = (SomeObject) FacesUtils.getManagedBean("item");
        List items = getItems();
        if (item != null) {
                int pos = 0;
                for (Iterator iter = items.iterator(); iter.hasNext() && 
iter.next() != item; pos++) {
                }
                orderItems.add(pos + 1, newItem);
        } else {
                orderItems.add(newItem);
        }
}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to