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 :
It is a default request method.
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).
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.
The doGet is more faster than doPost.
It is idempotent (Able to be repeated safely many times).
We cannot have doGet URLs of more than 1024 characters in length.
It allows bookmarks.
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 .
It can send unlimited amount of data to the server.
In doPost,the parameters are sent in separate line in the body.
It provides data security. suitable for applying encoading, encriprion, security algorithms.
It allow to deal with multipath form data.
Suitable for file uploading.
It is slower compared to doGet.
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)|