tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <>
Subject RE: What is the method of direct acces to an array element?
Date Fri, 25 Jun 2004 15:21:07 GMT
> From: Martin Cooper
> At the very least, you'll want to change the 'varStatus' 
> value to 'status' 
> and change the 'myLoopIndex' usage to 'status.index'. The 'varStatus' 
> attribute exposes a structure rather than an index.

Oops, yes, varStatus exposes a LoopTagStatus object:

Not only can you figure out what iteration you're on, but you can ask it
whether this is the first or last item, which is useful for things like
comma delimited lists so you don't display a comma after the final item.

Try this:

<c:forEach items="${firstArray}" var="myItem" varStatus="status">
   <c:out value="${myItem}"/>
   <c:out value="${secondArray[status.index]}"/>
   <c:out value="${thirdArray[status.index]}"/>

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message