This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Struts and the fly likes selecting a row in s:iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "selecting a row in s:iterator " Watch "selecting a row in s:iterator " New topic

selecting a row in s:iterator

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I am iterating rows for setting values in row elements...

In the UI after displaying these values I need to select any of the produced rows... In the above the rowid would be same for each row!

How to achieve it? This could have been in JS forum but usage of struts prompted me to be here ...
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
When I've had to do this I used the status attribute in the iterator tag to give me a variable that holds the index that that iterator is at, then I append the value of that variable to the id for the row, so in your case, something like this:

Hope that answers your question.
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
If we need to write this whole thing in Javascript can we achieve that?
David Newton

Joined: Sep 29, 2008
Posts: 12617

Achieve what? The original response provides the usual mechanism for identifying HTML elements.
I agree. Here's the link:
subject: selecting a row in s:iterator
It's not a secret anymore!