Method two service class httpservlet

  When the browser access html page, what happens when the data submitted to the servlet, which we need to know.

1. We need to look at the inheritance hierarchy servlet.

  Interface servlet -------> GenericServlet abstract class ---------> HttpServlet abstract class. . . . . .

When we use, usually inherited HttpServlet can rewrite and inside the doGet method doPost method, but in fact the method call is not so simple.

For example, there is a sign in the registration page, login.html after the form is submitted, it will be submitted to loginServlet class (inherited httpservlet class), call the service method in this class, but there are two service methods in this class, two overloaded method, the first call is following this method, the parameters of this method is the original req and res, but this method does not req and res objects for processing, it turned HttpServletRequest req type of strong,

                                                                        Then call another service method of this class of req were processed in the service method, this step is to call or dopsot such as doGet method.

 

 

    

Guess you like

Origin www.cnblogs.com/cold-windy/p/11071812.html