File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes getParameterValues() in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getParameterValues() in Servlet" Watch "getParameterValues() in Servlet" New topic

getParameterValues() in Servlet

m brymer
Ranch Hand

Joined: Jan 04, 2005
Posts: 64
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

Joined: Jan 04, 2005
Posts: 64
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

Joined: Mar 22, 2000
Posts: 13027
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.
I agree. Here's the link:
subject: getParameterValues() in Servlet
It's not a secret anymore!