The Serlvet interface defines only one service method as service, while the httpservlet class implements this method and requires that one of the following methods be called:
Doget: Process GET requests
Dopost: Process post requests
When sending a client request, call the service method and pass a request and response object. Servlet first checks whether the request is a get operation or a post operation. Then it calls the following method: doget or dopost. If the request is get, the doget method is called. If the request is Post, The dopost method is called. Both doget and dopost accept requests (httpservletrequest) and responses (httpservletresponse ).
So,
Doget is called when receiving a webpage using the get Method
Dopost is used to receive the POST method.
The get method is like a bunch of garbled characters you see in the address bar of the webpage, that is, parameters are added to the URL.
Post is passed through the form, as if to package all the data and send it to the past.
If you don't know what method to use, you can write all the functions together in the servlet.
Then you can call another method in one method.
For example
Public void dopost (httpservletrequest request, httpservletresponse)
Throws servletexception, ioexception
{
Doget (request, response );
}