Pr.Pg Next Pg

Servlets Form Data tutorials

  • You must have come across a situation where you need to pass some information from your browser to a web server for processing the data or booking some E-AirLine tickets online.

  • For passing data from browser to web server, browser uses two method, GET method and POST method.


GET method

  • GET method appends form-data into the URL in name/value pairs.

  • GET method URL look like below:


  • The length of a URL is limited about 3000 characters so large amount of data cannot be send using GET method.

  • You should never use GET for sending sensitive data like username, password or else it will be visible in the URL bar.

  • GET method is use full for form submissions where a user want to bookmark the result.

  • GET is better for non-secure data.

  • Servlet handles GET method request by using doGet method of servlet.


POST method

  • POST method do not appends form-data into URL.

  • POST method request are never cached.

  • POST method request do not remain in the browser history.

  • POST method request have no data limit restriction, it can send any amount of data.

  • POST method request cannot be bookmarked.

  • Servlet handles POST method request by using doPost method of servlet.


Different between GET and POST


Sr No




GET is a default method for sending data through HTML form.

POST primarly defined for sending data through HTML form


GET can be bookmarked

POST cannot be bookmarked.


Using GET we can send only ASCII characters

Using POST we can send any data including binary data also.


GET method data are visible to every one in URL bar of the web browser.

POST method data are not visible in URL bar of the web browser.


GET method should not be used when sending password or other sensitive data.

POST method should be used when sending password and other sensitive data.


GET method data can be cached.

POST method data can not be cached.

Pr.Pg border                                              Next Pg