For example, enter
Http: // ip: Port/web01/Hello
Step 1: the browser establishes a servlet container Based on the IP address and port.
Is also a simple Web Server) connection.
Step 2: the browser packs the request data (according to the HTTP protocol, this packet
Request Packet ).
Step 3: the browser sends the request data packet to the container.
Step 4: After the container receives the request packet, parse the packet and
The parsed data is encapsulated on the request object, and the container
Create a response object.
Step 5: Find the container based on the request resource path ("/web01/Hello ").
Servlet configuration, and then create a servlet object.
Step 6: The container calls the service method of the servlet object. The container will
The created request and response are passed as parameters to the service method.
Step 7: In the service method, you can obtain it through the request object.
Request Parameters and perform corresponding processing. The processing results are placed in the response object.
.
Step 8: The container extracts the processing result from the response object and then packs (
According to the HTTP protocol, this packet is called a response packet ). Then
The response packet is sent to the browser.
Step 9. After the browser receives the response packet, parse the processing result and generate
Corresponding page.
Detailed description of servlet running process