struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Skip Hollowell <>
Subject [S2]Loop through two arrays in my JSP
Date Thu, 26 Apr 2007 17:39:48 GMT
I have two Arrays (account.amt and and while they are both 
the same size, I don't know what that size is until the page gets em.  
If I really needed to I guess I could also put a size field into account.

But what is the best way to loop over them  and grab these values?

I can easily go over one field at a time:
    <s:iterator value="payment.datePaid">

I can't seem to find any looping constructs that would get me the index 
each time through and allow me to do something like:
  //index i=0
    <s:textfield key="payment.amtToPay" value="%{payment.amtToPay[i]}" 
theme="simple" />
    <s:textfield key="payment.datePaid" value="%{payment.datePaid[i]}" 
  //increment my index i

Am I missing some basic way of doing things, or am I way off base on my 
object definitions.  I tried the alternate way, creating an array of 
payments (instead of a payment with an array of dates and an array of 
amounts), with each payment having a date and an amount, but then I 
couldn't update these objects from the form (see earlier post and some 
suggestions from Mike Menard, which I wasn't able to get functioning)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message