• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MULTIPLE select - list box - how to read in servlet

 
Rao Nadella
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic