• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Getting Query String Params From A Post

 
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic