Java face question

Source: Internet
Author: User

One, servlet technology

1. What is a servlet

A custom-built component specification for the extended Web server side (Java applications on the server side). With platform and protocol-independent features, you can generate dynamic Web pages that serve as the middle tier for client requests and server-side responses.

2. Different from CGI

Java servlet is more efficient and resource-saving (CGI exists in the process of client request activation, and the request is unloaded after it is activated by the client's first request, and the servlet is running in the background, waiting to process the next request, each request being just a thread rather than a process. It is only uninstalled when the servlet container is stopped or restarted), easier to implement (CGI development is more difficult, the servlet inherits Java's easy-to-develop features), and has better portability (CGI is not portable).

3. When the servlet is initialized

If Loadonstartup is not set, it is instantiated the first time it is requested (after the servlet is instantiated, Tomcat invokes the Init () method to initialize the object)

Set Loadonstartup in three different situations:

(1) Loadonstartup < 0

In the case of negative numbers, the Web container is not instantiated when it is started, and is instantiated the first time it is requested.

(2) loadonstartup > 0

When the Web container starts, it is instantiated, the order is small to large, and the smaller the positive integer is first instantiated.

(3) Loadonstartup = 0

When the Web container is started, it is instantiated, equivalent to the maximum positive integer, which is initialized at web startup.

4. Links to related posts

When is the https://www.cnblogs.com/disneyland/p/4692339.html servlet instantiated?

52329543

A single-instance understanding of the 45898661 servlet

  

  

Java face question

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.