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 get v/s post request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "get v/s post request" Watch "get v/s post request" New topic
Author

get v/s post request

Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
My application is making a post request and action URL is assigned to form in the javascript dynamically.
But his URL also contains query string also e.g.

document.myform.action = 'http://www.abc.com/myapp/servlet/MyServlet?event=continue'

In some of the request processed at the serlvet level only value event=continue is received. Other parameters of the form are not received. It appears that form contents are not posted or evenif posted only values from query string are taken i.e. it may be treated like a GET request rather than POST request.

But this happens only in around 20% cases.

Any help of this would be highly appreciated.


Sanjeev Kaushik
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
exam your query string. It may contain special char.

Also you can change form ACTION to GET so that you will see exactly what is sent to server.


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

GET and POST are mutually exclusive and which one is actually used is determined by the browser.

Specifically, if you code a hyperlink or enter the URL manually, a GET request will be made. If you code a form with a 'method="POST"', a POST will be made. A form with no method given defaults to GET, but in Struts, the Struts form defaults to POST.

The format of the URL is immaterial, since the GET or POST request is made as an HTTP command by the browser. A server that attempts to decode a POST request's URL to pull "GET" parameters out is working improperly.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get v/s post request