Subtracting 2 values from different collections using for:each and el

2004-02-12 Thread Adam Bickford
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Subtracting 2 values from different collections using for:each and el

2004-02-12 Thread Karr, David
Read the specification.  These questions are easily answered there.  In
short, use the varStatus attribute.

-Original Message-
From: Adam Bickford [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 12:36 PM
To: Tag Libraries Users List
Subject: Subtracting 2 values from different collections using
for:each and el


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]