• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getParameterValues() in Servlet

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic