I learned this part of JSP a few days ago, but I couldn't remember the specific execution process when I heard about the JSP execution principle again. So I searched the internet and found that we had a few simple descriptions of the JSP execution process. Since there is no good article, let's write it by myself.
By the way, the JSP Execution Process Diagram of Mr. Wang is used to show the execution process. I believe that we will be able to know the entire execution process at a Glance next time.
First:
JSP execution process:
1. The first step is to send an HTTP request to the client (browser.
2. Then, the servlet container in the server finds that the URL suffix is. jsp.
Specific settings:
·
With these two steps, the Tomcat server will send the request ending with. jsp to the jspservlet class for processing.
3. Tomcat calls the jspservlet service method for relevant processing.
If we access JSP for the first time, jspservlet will be compiled into a Java class, which overwrites the service method of httpservlet and calls the _ jspservice method of the service method. We know that in servlet, the service method calls the doget or dopost method. After overwriting the service method, both get access and post access are processed in the _ jspservice method.
4. the Java class generated by tomecat returns the processing result.
Here, we need to note that the processing result returned by JSP contains HTML code, which is also the reason why JSP makes programming simple.
The above figure shows the entire execution process of JSP. Through this figure, we can master the entire execution principle of JSP execution in a simple and clear way.