You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Vinay <vi...@mdp.net> on 2003/02/07 00:26:12 UTC
Counter using Struts Taglibs
Hi All,
How can I define counters using Struts EL tag libraries for printing purposes in JSP pages
Here is an example
<table border="1">
<c:forEach var="transid" items="${trans.transactions}">
<tr>
<td><c:out value="${transid.acctno}"/></td>
<td><c:out value="${transid.testcode}"/></td>
if($transid.testcode=="ts" ) tscount=tscount+1;
<td><c:out value="${transid.srcfac}"/></td>
<td><c:out value="${transid.dateofservice}"/></td>
<td><c:out value="${transid.htkey}"/></td>
</tr>
</c:forEach>
</table>
In the above code i would like to print the total and number of iterations the for loop performed.
I would also like to do some condition to inside the for loop to print another specific counter
like
eg:--
if($transid.testcode=="ts" ) tscount=tscount+1;
I am novice and have recently started using these tag libraries.Is there a link or web site which has tutorials on how to use the tag libraries.
Any help appreciated
thanks
Vinay
Re: Counter using Struts Taglibs
Posted by Shawn Bayern <ba...@essentially.net>.
On Thu, 6 Feb 2003, Vinay wrote:
> Hi All,
> How can I define counters using Struts EL tag libraries for
> printing purposes in JSP pages
It looks like you're really asking about JSTL tags, not Struts.
You can use <c:set> to increment a variable, as in
<c:set var="counter" scope="session" value="${counter + 1}"> />
> I am novice and have recently started using these tag libraries.Is
> there a link or web site which has tutorials on how to use the tag
> libraries.
The JSTL specification is available at http://java.sun.com/products/jstl.
If that's too technical for you at the moment, there are also several
books on JSTL; more info on mine is available at the URL below.
--
Shawn Bayern
"JSTL in Action" http://www.manning.com/bayern
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org