tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Cooper" <martin.coo...@tumbleweed.com>
Subject RE: No "index" var in "forEach" tag?
Date Wed, 07 Aug 2002 18:25:35 GMT
What you're missing is the 'varStatus' attribute. The object made available
there has an 'index' property, amongst others, which I believe is exactly
what you're looking for.

--
Martin Cooper


> -----Original Message-----
> From: Karr, David [mailto:david.karr@attws.com]
> Sent: Wednesday, August 07, 2002 11:22 AM
> To: 'taglibs-user@jakarta.apache.org'
> Subject: No "index" var in "forEach" tag?
> 
> 
> Unless I'm missing something obvious, there doesn't appear to 
> be an "index"
> attribute in the "forEach" tag, which would specify a var to hold the
> current loop index.
> 
> This could have many uses, but probably a common one might be 
> something like
> this (I hope I have my syntax correct):
> 
>  <c:forEach var="item" items="collection" index="index">
>   <tr class="${styleClass[index mod 2]}">
>    ...
>   </tr>
>  </c:forEach>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:taglibs-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message