You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mike Quentel <mq...@4dm-inc.com> on 2009/06/08 20:09:29 UTC

how to use SelectionListener with command button

Please need help in understanding how to use the table row selection event
to extract data from a selected row in a table.  I do not understand how to
send the data from a selected row of a table to set a backing bean's
representation of that selected row.

I've seen the advice provided in the Developer Guide at: 

http://myfaces.apache.org/trinidad/devguide/communicatingBetweenPages.html

I am using Trinidad 1.2.11 with Tomcat 6.0..

By the way, would it be better to populate a table via another kind of
object, rather than using my current model of a Vector of Hashtables?  If
so, what class should I use?

Here is a command button: 

<tr:commandButton text="Edit Property Right"
id="editPropertyRightCommandButton" action="goToPropertyRightDescription">
        <tr:setActionListener
from="#{propertyRightBean.filteredPropertyRights}"
to="#{propertyRightBean.selectedPropertyRightListener}"/>
      </tr:commandButton>

The table is populated from a Vector of Hashtables, where each Hashtable
represents a row.

When the user clicks the Edit command button above, the following error
(abbreviated) is shown: 

Cannot convert [{geometry_ids ... plant_group=}] of type class
java.util.Vector to class org.apache.myfaces.trinidad.event.SelectionEvent

What sort of object must the data be in order to be converted to a
SelectionEvent?

The backing bean has this method signature: public void
setSelectedPropertyRightListener(SelectionEvent e) 

Thanks for any advice on this.

Mike Quentel