-2

In SpringMVC if suppose I can use POST method instead of the GET method, and it works. Then what is the purpose of these methods and how can we differentiate these methods?

Community
  • 1
  • 1
netajik
  • 196
  • 1
  • 4
  • 15

1 Answers1

2

As default browser requests pages and other resources using GET method.

If you using REST for some kind of web-service you may use GET, POST, PUT, DELETE and HEAD request (and some others).

GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect.

POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI.

PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.

DELETE method deletes the specified resource.

HEAD method asks for a response identical to that of a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.