JSF actionListener is called multiple times from within HtmlTable
Posted
by Rose
on Stack Overflow
See other posts from Stack Overflow
or by Rose
Published on 2010-05-31T08:05:52Z
Indexed on
2010/05/31
8:12 UTC
Read the original article
Hit count: 284
I have a mix of columns in my htmltable: 1 column is an actionlistener, 2 columns are actions and other columns are simple output.
<h:dataTable styleClass="table" id="orderTable" value="#{table.dataModel}" var="anOrder" binding="#{table.dataTable}" rows="#{table.rows}" <an:listenerColumn backingBean="${orderEntry}" entity="${anOrder}" actionListener="closeOrder"/> <an:column label="#{msg.hdr_orderStatus}" entity="#{anOrder}" propertyName="orderStatus" /> <an:actionColumn backingBean="${orderEntry}" entity="${anOrder}" action="editOrder" /> <an:actionColumn backingBean="${orderEntry}" entity="${anOrder}" action="viewOrder"/> ....
I'm using custom tags, but it's the same behavior if I use the default column tags.
I've noticed a very strange effect: when clicking the actionlistenercolumn, the actionevent is handled 3 times. If I remove the 2 action columns then the actionevent is handled only once.
The managed bean has sessionscope, bean method:
public void closeOrder(ActionEvent event) { OrdersDto order; if ((order = orderRow()) == null) { return; } System.out.println("closeOrder() 1 "); orderManager.closeOrder(); System.out.println("closeOrder() 2 "); }
the console prints the'debug' text 3 times.
© Stack Overflow or respective owner