The difference between HttpServlet and Servlet

Servlet is an interface that defines the servlet that must be implemented, and HttpServlet is a servlet specifically bound to the HTTP protocol.

httpservlet forced to transfer parameters in the service function:
ServletRequest—>HttpServletRequest;
ServletResponse—>HttpServletResponse

Different methods (doGet, doPost) are called according to different request methods (get, post), so if we write http services, we can directly inherit HTTPServlet, and then process them in methods such as doGet.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41504815/article/details/114897688