As you found out there is no way of knowing the order the browser/client will submit request parameters, so if you want to use indexed properties in this way you need to "grow" the list to accomodate the size of the indexed property being set.
So you could do something like the following: public void setDate(int index,String value) { while (datesList.size() <= index) { datesList.add(null); } datesList.set(index, value); } This is what LazyDynaBean / LazyDynaForm does: http://struts.apache.org/1.x/userGuide/building_controller.html#lazy_action_form_classes Theres also this page on the wiki: http://wiki.apache.org/struts/StrutsCatalogLazyList Niall On 9/21/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:
Hi, I have a no. of fields in a form arranged in a table of rows. I am using indexed properties for these fields. The number of these fields isn't known to me at the time of page loading for which I have used some DHTML to properly add the fields. And all the values are getting submitted. Now my problem is that the order is getting jumbled up. My table is like this No. Date Description 1. date[0] description[0] 2. date[1] description[1] But after submitting, the order gets jumbled up. i.e. i get something like this No. Date Description 1. date[0] description[1] 2. date[1] description[0] This I have figured is because of the following setter methods public void setDate(int index,String value) { datesList.add(value); } public void setDescription(int index,String value) { descriptionsList.add(value); } So basically the order in which the setter methods are called is random. i.e. setDate(0,value) - > setDescription(1,value) and so on. Does this problem mean we have no way of maintaining order when using lists? What I have thought of is instead of using Indexed Properties I will use map backed properties. But if somebody can offer me some sort of solution that doesn't require change from Lists to Map it would be great. -- Puneet
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]