java2db

Difference between servlet doGet and doPost methods



The doGet and doPost both are used to send the request to the server.

The main difference between servlet doGet and doPost are listed below :

doGet :

servlet doGet and doPost It is a default request method.
servlet doGet and doPost It designed to get data (Example:To get the simple HTML page,the results of a database query) from the server by generating request.
  It can send little amount of data to the server(max of 256 kb).
servlet doGet and doPost Shows the form page generated query string in the browser address bar (Parameters are appended to the URL).
 It does not provide data security.Not suitable for applying encoding , encription , security algorithms.
  Does not allow to deal with multipath form data that containing different types of content.
  Not suitable for file uploading.
servlet doGet and doPost The doGet is more faster than doPost.
 It is idempotent (Able to be repeated safely many times).
servlet doGet and doPost We cannot have doGet URLs of more than 1024 characters in length.
  It allows bookmarks.

doPost :

servlet doGet and doPost It is not a default request method.
 It is designed to send data (Form fields, large text bodies, and key-value pairs) to server along with the request .
servlet doGet and doPost It can send unlimited amount of data to the server.
servlet doGet and doPost In doPost,the parameters are sent in separate line in the body.
  It provides data security. suitable for applying encoading, encriprion, security algorithms.
servlet doGet and doPost It allow to deal with multipath form data.
  Suitable for file uploading.
  It is slower compared to doGet.
  Not idempotent.
 No URLs length restriction for doPost requests,because the information or the request data is encapsulated in the body of the request.
  It disallows bookmarks.




Related Posts :
Kill or invalidate session using session id ( concurrent login )
Servlet Filter ( Request and Response filters in servlets ) example
URL rewriting in servlets ( Servlet session tracking )
Servlet Cookies ( Servlets session tracking with cookie )
Hidden form field in servlets ( Servlet session tracking )
Request attributes in servlet with an example ( Attribute scope )
Session attributes in servlet with example (Attribute scope)
ServletConext Attributes in servlet ( Attribute scope )
   [will not be published]



^ <