tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Bickford <abickf...@ghsinc.com>
Subject Subtracting 2 values from different collections using <for:each> and el
Date Thu, 12 Feb 2004 20:35:38 GMT
In a nutshell, I want to iterate over a collection and subtract a value 
from a different collection with the same position as the current 
collection.  The problem is, I don't know how to reference the current 
iterator.

For example, how would I do something like this:

        int[] a =  {0,1,2,3,4,5,6,7,8,9};
        int[] b =  {9,8,7,6,5,4,3,2,1,0};
        for(int i = 0; i < a.length; i++){
            System.out.println(b[i]-a[i]);
        }

How could I achieve that in JSTL using el?
    <c:forEach var="total" items="${dailyTotals}">
          <td>
                  <c:out value="${total-(value in another collection 
with the same index as this loop)}"/>
          </td>
    </c:forEach>



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