What is the difference between Get and Post Method?

Answer Posted / meera

Difference between GET and POST methods

•Fundamental Difference is probably the Visibility - GET
request is sent via the URL string (appended to the URI
with a question-mark as separator), which is visible
whereas POST request is encapsulated in the body of the
HTTP request and can't be seen.
•Length - Since, GET request goes via URL, so it has a
limitation for its length. It can't be more than 255
characters long (though this is browser dependent, but
usually the max is 255 characters only). Whereas no such
maximum length limitation holds for the POST request for
the obvious reason that it becomes a part of the body of
the HTTP request and there is no size limitation for the
body of an HTTP request/response.
•Performance - GET request is comparatively faster as it's
relatively simpler to create a GET request and the time
spent in the encapsulation of the POST request in the HTTP
body is saved in this case. In addition, the maximum length
restriction facilitates better optimization of GET
implementation.
•Type of Data - GET request is sent via URL string and as
we all know that URL can be text-only, so GET can carry
only text data whereas POST has no such restriction and it
can carry both text as well as binary data.
•Caching/Bookmarking - again for the obvious reason that a
GET request is nothing but an URL hence it can be cached as
well as Bookmarked. No such luxuries with a POST request.
•FORM Default - GET is the default method of the HTML FORM
element. To submit a FORM using POST method, we need to
specify the method attribute and give it the value "POST".
•Data Set - GET requests are restricted to use ASCII
characters only whereas POST requests can use the 'enctype'
attribute with a value "multipart/form-data" to use the
Universal Multiple-Octet Coded Character Set (UCS).

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of servlet?

679


What are the different ways we can maintain state between requests?

584


What are the advantages of Servlet over CGI?

672


What is servlet in tomcat?

566


What are the two important api's in for servlets?

592






Which method is called when reference variable is passed in system.net?

1840


Explain get and post.

653


Which interface must be implemented by all servlets?

805


What exception should be thrown when servlet is not properly initialized?

561


What is servlet interface?

713


Can filter be used as request or response?

548


What methods do you use in servlet - applet communication?

590


Who is responsible for writing a constructor?

783


What is servlet mapping?

605


What mechanisms are used by a Servlet Container to maintain session information?

674