wood burning stoves 2.0*
The moose likes Servlets and the fly likes MULTIPLE select - list box - how to read in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "MULTIPLE select - list box - how to read in servlet" Watch "MULTIPLE select - list box - how to read in servlet" New topic
Author

MULTIPLE select - list box - how to read in servlet

Rao Nadella
Greenhorn

Joined: Jan 19, 2001
Posts: 16
Is there any way to read the MULTIPLE selected items in the list box from a JSP page to be read in the servlet. I used the getParameterNames with the Enumeration object and the items that shows up as selected is the 1st one selected in the list - meaning if there are 10 items and if I select 3rd,4th and 5th items the selected item is shown as 3rd. And if I select 6,7 and 8th items the item selected is shown as 6th.
How can I get the items that are selected on the list box with a MULTIPLE option?
Appreciate any help, thank you.
-R
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
If a particular parameter can have multiple values, you have to use getParameterValues. So in your case:
String[] values = yourParameterName.getParameterValues().
Then iterate through the array to get alla the values for your parameter.

------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MULTIPLE select - list box - how to read in servlet