Header Ads

ad

GET VS POST

Difference between GET and POST

GET Request Mode

a) GET is default request mode i.e if nothing is specified then by default it is GET.

b) It is basically given to send request and to read/get the data.

c) GET can carry limited amount of data(2kb-4kb).

d) Data is visible on the browser address bar along with url when request is sent. So, lack of secrecy.

e) To process GET mode request in our Servlet class, we use either service() method or doGet() method.

f) GET supports only character data.

g) GET supports caching.

h) GET is idempotent.

i) GET is recommended to use when we generate the request using hyperlinks.

j) There are various ways to generate GET mode request :-
  • <a href="home.htm">Home Page</a>
  • <form action="user.htm" method="GET">
          -----------
          -----------
       </form>
  • <form action="user.htm">
         ------------
         ------------
       </form>

POST Request Mode


a) POST mode of request is used to write the data through form.

b) It can carry unlimited amount of data.

c) Data is not visible on the browser address bar when form is submitted.

d) POST supports different MIME type of data(Binary data) such as images, files videos etc.

e) POST does not support caching.

f) POST is not idempotent.

g) To process the POST mode request in our Servlet class, we use either service() method or doPost() method.

h) POST is recommended when we generate the request using form.

i) This is the way to generate POST mode request :


  1.    <form action="user.htm" method="POST">
  2.        ---------
  3.        ---------
  4.     </form>


No comments