| Author |
Processing Identically Named Form Fields?
|
Jason Ferguson
Ranch Hand
Joined: Sep 16, 2007
Posts: 47
|
|
I can't try this for myself for a few days, but would like to try to find out so that I don't waste my time when I can do it. Supposing I had a JSP with two identical text input fields: <form action="/processingServlet"> <input type="text" name="serialNumber" /> <input type="text" name="serialNumber" /> <input type="submit" value="Add Serial Numbers" /> </form> When the form is submitted to the ProcessingServlet, what would be in the HttpServletRequest for serialNumber? An array, or nothing? Again, I'd try for myself, but it will be a few days before I can. Jason
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
The HTTP request will have both name/value pairs. But you don't care about that unless you are parsing the request yourself. To get both values as an array, be sure to use the getParameterValues() method. [ January 20, 2008: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Jason Ferguson
Ranch Hand
Joined: Sep 16, 2007
Posts: 47
|
|
|
Thanks Bear (yet again). Now that you point out getParameterValues(), it seems like I asked a dumb question.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
If you learned something you didn't know, how is it dumb?  [ January 20, 2008: Message edited by: Bear Bibeault ]
|
 |
 |
|
|
subject: Processing Identically Named Form Fields?
|
|
|