This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes POST - Accepts Passive resource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "POST - Accepts Passive resource " Watch "POST - Accepts Passive resource " New topic

POST - Accepts Passive resource

Srinivasan Madhavan

Joined: Sep 21, 2004
Posts: 10

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,
Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92

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,

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: POST - Accepts Passive resource
It's not a secret anymore!