File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "getParameterValues() in Servlet" Watch "getParameterValues() in Servlet" New topic
Author

getParameterValues() in Servlet

m brymer
Ranch Hand

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

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
Rancher

Joined: Mar 22, 2000
Posts: 12788
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getParameterValues() in Servlet