• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get v/s post request

 
Sanjeev Kaushik
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic