HttpServlet
javax.servlet.http.HttpServlet (abstract class)
The immediate super class of HttpServlet is GenericServlet.
It defines a HTTP protocol specific servlet.
HttpServlet is a sub class of GenericServlet class.
All methods are concrete (non-abstract). service() is non-abstract method. service() can be replaced by doGet() or doPost() methods.
doGet()
In doGet(), parameters are appended to the URL and sent along with header information
Maximum size of data that can be sent using doGet() is 240 bytes
Parameters are not encrypted
Application:
Used when small amount of data and insensitive data like a query has to be sent as a request.
It is default method.
doGet() is faster comparatively
doGet() generally is used to query or to get some information from the server
This is default method of http
doPost()
In doPost(), parameters are sent in separate line in the body
There is no maximum size for data
Parameters are encrypted here
Application:
Used when comparatively large amount of sensitive data has to be sent.
E.g. submitting sign_in or login form.
doPost() is slower compared to doGet() since doPost() does not write the content length
Dopost() is generally used to update or post some information to the server