This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Passing values from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing values from JSP" Watch "Passing values from JSP" New topic

Passing values from JSP

Smitha Prasad
Ranch Hand

Joined: Apr 02, 2002
Posts: 41
I need to pass a list of accounts from JSP to servlet. In my Jsp a list box containing a list of values is present. Multiple selection is allowed. When multiple projects are selected, how do i pass this as a parameter to my servlet?? Help!
David Gilmore

Joined: Jul 19, 2002
Posts: 9
Can you not just put them in an arrayList and do request.setAttribute("accounts", your_arraylist)?

There are 10 types of people in this world - those who understand binary and those who don't.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
The JSP presents a form that has a list box that allows multiple selections? The form on the JSP has an action that directs it to the servelt?
In the servlet just use the getParameterValues( ) method of the Request object. It returns an array of strings that are all of the values of any multi-valued parameters sent.

S Srikanth

Joined: Sep 09, 2002
Posts: 14
Hi smita ,
Use "getParameterValues" to get multiple values from a jsp page
I agree. Here's the link:
subject: Passing values from JSP
Similar Threads
hows can i retrieve the values from a multiple select list in a jsp??
Using Values in a List form one JSP to Another
After page loads, clear form bean value
how to pass arraylist from jsp to java bean
Passing Multiple Values to another jsp page from a List Box