Actually, you can do one better than that. Just pass in beans to the
form(can have collections in them), and that way you don't have to put a
bunch of attributes and getter/setters in your form. Of course you will
need a getter for your bean that you put in your ActionForm. As a result,
my ActionForms are very thin, take advantage of reuseability, better
performance, and alot less work.
Learned trial and error on this one,
Kent
-----Original Message-----
From: Anthony Xin Chen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 6:48 PM
To: SUPRIYA MISRA
Subject: Re[2]: Multiple input fields
Hello there,
Although I have not tried it personally, I read from the list that it
can be done if your ActionForm provides a setter which takes a
collection and a getter which returns a collection.
Thursday, August 16, 2001, 5:03:15 AM, you wrote:
SM> No the last category will overwrite the previous ones. You need to add
an
SM> integer to category.
SM> <%int x= 0 ;%>
SM> <TD><input type="text" name="category<%=x>" value=""></TD>
SM> <%x++;%>
SM> <TD><input type="text" category<%=x>" value=""></TD>
SM> request.getParameterValues("category0")
SM> request.getParameterValues("category1")
SM> The best option is to loop it the value of x times;
>>From: [EMAIL PROTECTED] (Andrew Myers)
>>Reply-To: [EMAIL PROTECTED]
>>To: [EMAIL PROTECTED]
>>Subject: Multiple input fields
>>Date: Thu, 16 Aug 2001 02:22:02 -0400
>>
>>Is it possible to have multiple input fields with the same name?
>>
>>Eg. In regular HTML I would do this
>>
>><form action="blah">
>>
>><TABLE>
>> <TR>
>> <TD>Category</TD>
>> <TD>Description</TD>
>> </TR>
>>
>> <TR>
>> <TD><input type="text" name="category" value=""></TD>
>> <TD><input type="text" name="description" value=""></TD>
>> </TR>
>>
>> <TR>
>> <TD><input type="text" name="category" value=""></TD>
>> <TD><input type="text" name="description" value=""></TD>
>> </TR>
>>
>>...
>>
>></TABLE>
>>
>>
>></form>
>>
>>Then when access all the parameters by calling
>>request.getParameterValues("category")
>>Can ActionForm Beans handle multiple values with the same field name? If
>>so how is this achieved?
>>
>>Thanks,
>>Andrew.
>>
>>
>>__________________________________________________________________
>>Your favorite stores, helpful shopping tools and great gift ideas.
>>Experience the convenience of buying online with Shop@Netscape!
>>http://shopnow.netscape.com/
>>
>>Get your own FREE, personal Netscape Mail account today at
>>http://webmail.netscape.com/
>>
SM> _________________________________________________________________
SM> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp
--
Best regards,
Anthony