Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Query String Params From A Post

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic