Yes, you can be sure, because form elements are actually an array, and one
element will follow another.

Mark

-----Original Message-----
From: Mark Silva [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 1:59 PM
To: Struts Users Mailing List
Subject: RE: Design Problem: Multiple Object Update


Pavel,

Can we assume that the parameters will be sent in the right order?  I have
always assumed that this was something that could not be guarenteed with a
form submission?  i could be wrong about this point.

thanks,
mark


-----Original Message-----
From: Pavel Kolesnikov [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 10:57 AM
To: Struts Users Mailing List
Subject: RE: Design Problem: Multiple Object Update


On Fri, 4 Oct 2002, Mark Silva wrote:

> so if you had a bunch of parameters like so
> 
> category=XYZ&key=123&category=ABC&key=256&category=AAA
> 
> how does struts correspond the category to the key? 

They don't. You have to go manually through all the arrays
(getCategory, getKey etc) and suppose all the values are
set in the appropriate order.

So you can do somthing like:

for (i = 0; i < key.size && i < category.size; i++) {
        System.out.println ("key: " + key[i]
                 + ", category: " + category[i]);
}

I think it's nicer than parsing stuff like
123_category=XYZ&124_category=ABC&129_category=AAA&123_color ...
;)

Pavel




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


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

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

Reply via email to