Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

POST - Accepts Passive resource

 
Srinivasan Madhavan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I observe something weird with the HTTP POST method. I have a html form with POST given as the method attribute in the <form> tag. The action attribute has a passive resource (say test.html) and submitting the form fetches the passive resource. I was all along thinking that the POST method was for the purpose of Active resources ( Servlets & JSPs) only. Besides I didn't find the logic in allowing a passive resource to be associated with the POST method when we have the GET method for it.

I tried this on a Tomcat container.

Thanks in advance,
Srini
 
Henrique Sousa
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

You would have to check the HTTP specs for the precise answer, but I can only tell what we can observe. Try it yourself: with the POST method, the URL to the destination resource, whether it is a servlet or not, remains unchanged, without any query parameters passed; the opposite happens if you use the GET method: the URL is appended of all query parameters in the browser window after the destination is loaded.
That is the main difference I see, and has no relation to the nature of the resources you use -- after all, everything ends up creating a plain HTML page. As I said, go to the specs for further info. Best regards,

Henrique
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic