| Author |
JSTL iteration of a list with numbering
|
Sverre Moe
Ranch Hand
Joined: Jul 10, 2007
Posts: 109
|
|
I am iterating over an ArrayList of objects. For each entry I createe a table row encapsulated within a form. In addition to iterate through the ArrayList I need to insert a number within the iteration so that each form element gets it unique id. If it was scriptlet I would have no problem, but I am using JSTL <c:forEach> How can I get the value for each iteration and pass it into formID#. Somehow I need to access the iteration number, like the i in for(int i = 0; i<list.size();i++) I am using JSTL 1.1 and JSP 2.0 with Servlet-API 2.5
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Use varStatus attribute of the forEach tag : varStatus is of type LoopTagStatus. Check the API for the details of this class. [ August 22, 2007: Message edited by: Christophe Verre ]
|
[My Blog]
All roads lead to JavaRanch
|
 |
Sverre Moe
Ranch Hand
Joined: Jul 10, 2007
Posts: 109
|
|
Originally posted by Christophe Verre: Use varStatus attribute of the forEach tag : varStatus is of type LoopTagStatus. Check the API for the details of this class. [ August 22, 2007: Message edited by: Christophe Verre ]
Thanks, just what I was looking for
|
 |
 |
|
|
subject: JSTL iteration of a list with numbering
|
|
|