| Author |
Getting Query String Params From A Post
|
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
Is it not possible to get params from the query string using a doPost? I have the following URL: I am not able to get any of the parameters in my servlet. I don't know why. Here is the doPost: Any ideas? Thanks, Luke
|
Luke
SCJP
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
The Part object is an abstract upload part which represents an INPUT form element in a multipart/form-data form submission. Parameters in the Query String are not part of an INPUT in the form. Could this be the problem? http://www.servlets.com/cos/javadoc/com/oreilly/servlet/multipart/Part.html [ September 16, 2005: Message edited by: Luke Shannon ]
|
 |
Dustinn Yourstone
Greenhorn
Joined: Sep 16, 2005
Posts: 4
|
|
|
Yes, check the type of data you are sending, but also you always want to try to use the get for this so you don't haveto worry about this problem.
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
I need to do a Post because some of the data coming through the form is uploaded files. This is why I am using oreilly.servlet.multipart.MultipartParser to process the results from the post. Thanks, Luke
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
I just added some debugging statements to check what parameters were coming in from the form. It is not even receiving the query string parameters. Not sure why not? Code Change: Debugging Result:
|
 |
Vikas Bhatia
Greenhorn
Joined: Mar 22, 2005
Posts: 17
|
|
Originally posted by Luke Shannon: Is it not possible to get params from the query string using a doPost? I have the following URL: I am not able to get any of the parameters in my servlet. I don't know why. Here is the doPost: Any ideas? Thanks, Luke
You already might have tried it but have to tried to add the following line to your doget? doPost(request,response); I think the default behavior of the containter is to see a request as a get, the moment it sees some parameter being passed back to the servlet. Worth a try??
|
 |
 |
|
|
subject: Getting Query String Params From A Post
|
|
|