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 How to get  values from list to JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get  values from list to JSP" Watch "How to get  values from list to JSP" New topic
Author

How to get values from list to JSP

jeyaveera pandian
Ranch Hand

Joined: Sep 29, 2000
Posts: 39
Hi friends,
I have wrote a program in JSP. I called that JSP from a HTML file in which i have created one list <select> with multiple selection mode. while i tried to get and print the selected values of that list using request.getParameter('listName'), it prints all the selected items of that list in a single line only.
I want to print all those selected items line by line. Plz help me in this regard.
Thanks in advance,
Anbudan,
K.Jeyaveerapandian
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
All I can think of at the moment is that you'll need to use StringTokenizer passing in the String you get back from the request and using a space as a delimiter, then use a while(tokenizer.hasMoreTokens()) loop to println each token in turn.
There may be a better way but I just can't think of it at the moment.


Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Jeyaveera pandian,
A small change in your code will do I think. Use getParameterValues method . It will return a String array of all values selected. Then you manuplate this String array according to your needs.

regds
maha anna
[This message has been edited by maha anna (edited December 05, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get values from list to JSP
 
Similar Threads
MULTIPLE select - list box - how to read in servlet
retrieving list (multiple select on the form) values into servlet!!!
Sending the list from server to the JSP
help in JSP
Mapping list to type