What is the difference between GET and POST ?

1)The data sent with GET is appended to the request URL(some times called query string) But in POST the data is transmitted withen the body of the request.

2)The total amount of data in GET is limited(512bytes-the amount of data in the actual path) but in POST it is unlimited.

3)GET method is not secure because the submitted data is visible in the URL. But in POST it is not visible.

4)So GET is used only for retrieving the data. But POST can be used for saving, uploading data.

5)POST has a body along with the header but GET has only header information no body.

6)Example:

Suppose there is a URL www.bhabani.com. When we open this there is two fields name, password and a submit button.
When we give the name=bhabani and password=java and click submit then
If we use GET method the URL becomes like this
www.bhabani.com/GET/MyJSP.jsp?name=bhabani&password=java HTTP/1.1
here above everything is visible in the URL. The extra part added is known as query string.

But if we use POST the url becomes like
POST/MyJSP.jsp HTTP/1.1 – no data in the URL
Here the data comes along with the message body(payload).

No comments:

Post a Comment