JSP is essentially a servlet,jsp compile is a "class servlet"
When a JSP server compiles a JSP page, it first writes a servlet to parse the JSP page content, using <%%> to turn it into a servlet, a Java class
To access the JSP by file name, where the configuration suffix named JSP is found according to the servlet configuration in the Tomcat server
Conf/web.xml files under the--tomcat directory
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
Then use the JSP engine to turn the JSP into a servlet
When accessing a JSP page, this request is actually a servelt
Difference: The application logic of the servlet is in the Java file and is completely detached from the HTML in the presentation layer. In the case of JSP, Java and HTML can be combined into a file with a. jsp extension. The JSP focuses on the view, Servelt primarily for logical control.