Home Tutorial Servlet Java Servlet : Difference between GET and POST

 
 

Share on Google+Share on Google+
Java Servlet : Difference between GET and POST
Posted on: October 9, 2012 at 12:00 AM
Advertisement
In this section, we will differentiate the GET and POST method of servlet.

Java Servlet : Difference between GET and POST

In this section, we  will differentiate the GET and POST method of servlet.

GET - It is HTTP method, asks to get thing at the requested URL.

POST - It is HTTP method, asks the server to accept the body info attached to the request, and give it to the thing at the requested URL. It is like GET with extra info sent with the request.

Difference :

  • Although both GET and POST can send parameters but POST has a body. With GET, the parameter data is limited to 255 character only what you can stuff into the Request line. In POST, there is no such length limitation because it works as a part of the body of the HTTP request and there is no size limit for the body of an HTTP request/response.
  •  When we use GET, you can see the parameter data in the browser's input bar, right after the actual URL, which is separated by a "?". It is not a secure way to send request. POST request is encapsulated in the body of the HTTP request So you can use POST in such case because POST method provides security.
  • If we talk about the performance then we find that the GET request is faster than POST request because GET request creation is simpler and it also save time which is spent in encapsulation of POST request. The maximum length limitation gives a better optimization of GET implementation.
  • GET request holds only text data as it is sent through URL string and we know URL can be text-only. In POST request there is no restriction so you can carry both text as well as binary data.
  • GET is idempotent that is it can be executed more than once without any bad side effects. It is used for getting things,and it don't change anything on the server. POST is not idempotent, the data submitted in the body of the POST might be bounded for the transaction that can't be reversed.
  • POST is not default so if you want to use POST specify in your form method="POST". HTTP GET request is default .

 

Advertisement

Related Tags for Java Servlet : Difference between GET and POST:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 9, 2012

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com