Servlet basics

1. What is Servlet?

  Servlets are small programs that run on a server. A servlet is a Java class and a servlet program that resides in server memory that can be accessed through the "request-response" programming model.

2. Tomcat container level:

  The container of Tomcat is divided into four levels, the container of Servlet manages the Context container, and a Context corresponds to a Web project.

  

 3. Steps to write a servlet class:

  ①Inherit HttpServlet

  ②Rewrite the doGet() or doPost() method

  ③Register Servlet in web.xml

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325329953&siteId=291194637