Three kinds of servlets for processing request in Tomcat

There are 3 types of processing requests in Tomcat

1. Static resource request 

      For example, static resources such as html, css or image are processed by DefalutServlet in Tomcat

2, jsp request 

      For example, requests such as index.jsp are processed by JspServlert in Tomcat

3. Other requests

      For example, when the mobile terminal requests an API such as getInfo.do, it is processed by the specific servlet.  

      If it is springmvc, it will be handled by DispatcherServlet

 

Let's analyze how to return userInfo.jsp interface for PC-side requests like student/userInfo.do

First, it is processed by the DispatcherServlet and then processed by the InternalResourceViewResolver configured in springmvc to obtain userInfo.jsp and forward the request. After forwarding, since our DispatcherServlet does not process the Handel of the .jsp request, it is processed by JspServlert, and the forwarding is only the server will The processing power of the request is transferred to another Servlet, so the request object is the same, so the data can be stored in the request in the DispatcherServlet, and then the data is reflected on the interface using jstl and el expressions in the JSP interface

Look at the explanation of Tomcat on Tomcat official website

Tomcat is an open source implementation of servlet, jsp, el and other technologies, and DefalutServlet JspServlert is one of the specific implementations

Guess you like

Origin blog.csdn.net/l1509214729/article/details/81331461