Home > Java > javaTutorial > body text

What is a servlet container

清浅
Release: 2020-09-08 14:58:19
Original
9304 people have browsed it

The Servlet container is a program that is a part of the Web server that interacts with servlets. It can receive requests from web pages and then redirect these requests to Servlet objects, and then return dynamically generated results to in the correct location.

What is a servlet container

#In Java, the Servlet container is used to generate dynamic web pages. So the servlet container is the fundamental part of the web server that interacts with java servlets. Next, I will give you a detailed introduction to what a Servlet container is in the article. I hope it will be helpful to you

What is a servlet container

[Recommended course: Java Tutorial

Servlet container

The Servlet container is a program that can receive requests from Web pages and redirect these requests to Servlet objects. The basic idea of ​​the Servlet container is to use Java to dynamically generate Web pages on the server side. So a servlet container is essentially a part of a web server that interacts with a servlet

Servlet Container Status

A servlet container is a part of a web server that can run in a separate process . We can divide the servlet container status into three types:

  • Independent: It is a typical Java-based server, where the servlet container and the web server are parts of a single program. For example: Tomcat runs itself

  • In-process: It is decoupled from the web server because different programs run as plugins within the main server's address space. For example: Tomcat runs in JBoss.

  • Out-of-process: Web servers and servlet containers are different programs running in different processes. To perform communication between them, web servers use plug-ins provided by the servlet container.

What is a servlet container

How the Servlet container works

1. The Web server or HTTP server where the browser accesses the page

2. The web server redirects the request to the servlet container (servlet is an HTTP listener running within the servlet container), and the servlet container redirects the request to the appropriate servlet

3 , dynamically retrieve the servlet and load it into the container's address space (if it is not in the container), the first time the servlet is loaded for initialization, the servlet container will call the servlet init() method once.

4. Call the service() method of the servlet to process the HTTP request, that is, read the data in the request and formulate a response. The servlet remains in the container's address space and can handle other HTTP requests.

5. Web servlet generates data (HTML pages, pictures...) and returns dynamically generated results to the correct location.

What is a servlet container

Summary: The above is the entire content of this article, I hope it will be helpful to everyone.

The above is the detailed content of What is a servlet container. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!