Thanks for these replies and the generous code samples.  I got frustrated
with the nested tag and re-wrote the iteration with jstl as Wendy suggested.
I had a few additional problems because I was using jstl 1.1 in a 2.3
container, but resolved that too.

-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 23, 2004 5:46 PM
To: Struts Users Mailing List
Subject: RE: Getting index value of iteration


> From: Tom McCobb [mailto:[EMAIL PROTECTED]
> In another section of the page I display an iterated list of
> items in a collection.
> I am stuck on how to get the value of "i", the index of the row
wherein the button was clicked.

Are you willing to use JSTL?  The <c:forEach> tag has 'varStatus' which
will give you the integer position as you loop through the collection.
This won't be exactly right, I haven't worked with it for a while,
but...

<c:forEach items="${myCollection}" var="myItem" varStatus="myLoopIndex">
    <c:out value="${myLoopIndex}"/>
    <c:out value="${myItem}"/>
</c:forEach>

Are these links, or do you need to submit the form with the index as one
of the form properties?  Do you have any objection to JavaScript?

With Struts-EL and JSTL, I haven't needed to venture into the Nested
taglib, although I understand there are things it can do that
Struts-EL/JSTL cannot.  This may be one of them...

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to