Java Mailing List Archive

Home » Home (12/2007) » Struts 2 »

Accessing a row in a table on a JSP page.




I call the database and create an ArrayList of beans to hold the data. Using
JSTL I iterate over the list
to display the data in an html table inside a form in a JSP page.

<c:set var="dataItems" value="${lmdao.listingManagerData}" />
<c:forEach var="item" items="${dataItems}" varStatus="row" >
I can give each row a number using ${row.index}

The last but one column is a Struts html:select that allows the user to
select what they want to do next. The last column contains a button to press
to implement the selected action. So far so good.

My problem is that in whichever row the button is pressed it always acts on
the data in the first row.
I have tried several ways including indexed properties or using an
ActionForm with an array of beans so each row is a copy of the bean, but I
cannot get the action to act on the required row.  

Is there a way in Struts for the action to know in which row the button was
pressed? Apart from the html:select dropdown all the other values required
for the action are hidden values.

Thanks in advance for any help with this.

Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.