The life cycle of the Jsp/servlet __jsp

Source: Internet
Author: User

JSP is the essence of the servlet, the developer's JSP file will be compiled by the Web container into the corresponding servlet, when the servlet is running in the container, the creation and destruction of its instance is not determined by the programmer, but by the Web container control.

There are two opportunities to create a servlet:

1. When a client requests a servlet for the first time, the system creates an instance of the servlet, most of which are the servlet.

2.WEB application starts to create a servlet instance immediately, that is, Load-start-servlet.

Each servlet runs in accordance with the following life cycle

1. Create a servlet instance

The 2.Web container invokes the servlet's Init method and initializes the servlet

3.Servlet initialization will always exist in the container to respond to client requests. If the client sends a GET request, the container invokes the Doget method to process and respond to the request, and if the client sends a POST request, the container invokes the Dopost method in the servlet to process and respond to the request. Or use a unified service () method to handle responding to customer requests.

4.WEb container when deciding to destroy a servlet, first invoke the servlet's Destroy () method, which usually destroys the servlet when the Web application is closed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.