• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getParameterValues() in Servlet

 
m brymer
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a servlet that is getting some multiple values from a hidden field on a jsp form BUT it is is stringing those multiple values in the sql query. For example the user selects test1 and test2 the servlet picks up the parameter and passes it to the sql query as "selected=test1&selected=test2&" I thought I had the parameter broken up correctly but I must be missing something. Can someone take a look and see where I am going wrong? Thanks!
 
m brymer
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Well, I can get the values but they don't seem to be formatting correctly. they come in from the hidden field as test1,test2,test3 and insert into one record in my database exactly the same way. Can anyone tell me what I am missing? Thanks!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from a hidden field

If there is only one hidden field, then what did you expect?
getParameterValue is used when multiple fields have the same name, as in SELECT options that allow MULTIPLE.
If there is only one field, you will have to parse out the values.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic