Hi Skip

http://husted.com/struts/tips/006.html
from id of the iterate is then used to reference name (for the specific array value indicated by property)

Does this help?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- From: "Skip Hollowell" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Thursday, April 26, 2007 1:39 PM
Subject: [S2]Loop through two arrays in my JSP


I have two Arrays (account.amt and account.date) 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">
     <s:property/>
   </s:iterator>

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
 <somesortaloopcontracut>
<s:textfield key="payment.amtToPay" value="%{payment.amtToPay[i]}" theme="simple" /> <s:textfield key="payment.datePaid" value="%{payment.datePaid[i]}" theme="simple"/><br>
 //increment my index i
</s:iterator>


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



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

Reply via email to