tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Coleman" <kcole...@commercebenefitsgroup.com>
Subject RE: counter in forEach tag?
Date Thu, 26 May 2005 17:17:35 GMT
You can use the varStatus property of the forEach tag.

<c:forEach var="asset" items="${assetCollection}" varStatus="status">

And then you can get the current count of the iteration.

${status.count}

Karl

-----Original Message-----
From: Scott Purcell [mailto:spurcell@vertisinc.com]
Sent: Thursday, May 26, 2005 12:58 PM
To: taglibs-user@jakarta.apache.org
Subject: counter in forEach tag?


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


The information contained in this transmission contains confidential  information that is
legally privileged. This information is intended only for the use of the individual or entity
named above. The authorized recipient of this information is prohibited from disclosing this
information to any other party unless required to do so by law or regulation and is required
to destroy the information after its stated need has been fulfilled.
If you are not the intended recipient, you are hereby notified that any disclosure, copying,
distribution, or action taken in reliance on the contents of these documents is strictly prohibited.
If you have received this information in error, please notify the sender immediately by return
email or phone at 800-223-9941 and arrange for the return or destruction of these documents.


---------------------------------------------------------------------
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