• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing values from JSP

 
Smitha Prasad
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you not just put them in an arrayList and do request.setAttribute("accounts", your_arraylist)?
David
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi smita ,
Use "getParameterValues" to get multiple values from a jsp page
Srikanth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic