tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Schwartz ...@arrayone.com>
Subject Re: counter in forEach tag?
Date Thu, 26 May 2005 17:19:12 GMT
1. Add this to your forEach...

varStatus = "stat"

2. Add this to the rows...

<c:when test = '${stat.count % 2 == 0 }' >
    <c:set var = "backColor" value = "White" >
</c:when>
<c:otherwise>
    <c:set var = "backColor" value = "Yellow" >
</c:otherwise>

This example create alternating colors for odd/even rows.


Quoting Scott Purcell <spurcell@vertisinc.com>:

>> Hello,
>> I have this scenario come up occasionally, and have to opt to JSP
>> expressions on the page for a work-around.
>>
>>  <c:choose>
>>                   <c:when test="${assetCollection == null}">
>>                      nothing
>>                   </c:when>
>>                   <c:otherwise>
>>                     <c:forEach var="asset" items="${assetCollection}">
>>
>>
>> BODY
>>
>>
>>                       <c:out value="${asset.assetId}" />
>>                     </c:forEach>
>>                   </c:otherwise>
>>                 </c:choose>
>>
>>
>> In the forEach section, I am going to create a rows in a table which will be
>> different colors for each row. How can I put in a counter that I can then
>> change the row color for? Basically, I would like to know what asset I am on
>> in the body.
>>
>> Thanks,
>> Scott
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
>>


David Schwartz

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


Mime
View raw message