File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Multiple Selections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Multiple Selections" Watch "Multiple Selections" New topic
Author

Multiple Selections

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I wanted to know how to handle multiple selections of drop down boxes in servlets. Now when I select multiple items in my drop down...when I am actually inserting them into the database, its just inserting the first selection but not all. Is there any specific way to handle this in servlets.

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Are you using request.getParameterValues() as opposed to request.getParameter()?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

How are you trying to do this?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I am using request.getParameter(). But when I use this its taking only first selection. Do I need to use request.getParameterValues() ?

Thanks.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yes, it will return a String[].
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Thanks a lot for ur reply. But when I use request.getParameterValues() also its just taking only one selection...but now its just inserting the 2nd selection only but not first.

Please help.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

getParameterValues returns an array; String[].

You will need to iterate through this array and perform your insert, delete, update, whatever on each of them.
[ February 23, 2005: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Selections