If you leave the descriptions variable set to null and offer a getter, then XWork will use its own XWorkList which will take care of this for you.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > news.gmane.org > Sent: Monday, March 08, 2004 4:26 PM > To: [EMAIL PROTECTED] > Subject: [OS-webwork] Setting List Values in model object from form values > > Hi, > > I am trying to do the following for form submission, but I am having > trouble > thinking up of how to get the form values into a list object in the model. > > Say for instance, I have three text fields, which contains 3 optional > descriptions of a product item. When I press submit, I would like these 3 > descriptions to be put into one List object. At first, my impression is > that this is similar to setting checkboxes: > > <input type="text" name="descriptions[0]" value=""/> > <input type="text" name="descriptions[1]" value=""/> > <input type="text" name="descriptions[2]" value=""/> > > Then in my model object: > > ArrayList descriptions = new ArrayList(); > > public List getDescriptions() { > return descriptions; > } > > However, when this is run, OGNL decides to use the List.set() to set the > values. This obviously causes an ArrayOutOfBoundsException since the size > is 0. > > I would like to have the descriptions be set in one list object, in the > order that is filled out. I tried using String[] which still doesn't > work. > And HashMap would not maintain the order. So I'm a little stuck. > > What is the properly form field name to use so that it can add the values > into just one List object? > > Thanks, > Chris > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork