This is the 20th day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021


First, JavaWeb concept

1.1 what is JavaWeb

Web resources accessible to the outside world on the Internet are classified into the following types: Static Web resources (such as HTML pages) : The data on a Web page for people to browse remains unchanged. Dynamic Web resources: The data in a Web page for people to browse is generated by the program, and the content of the Web page is different at different points in time. Static Web resource development technology: HTML, CSS. Dynamic Web resource development technology: JavaScript, JSP/Servlet, ASP, PHP, etc. In Java, dynamic Web resource development techniques are collectively known as the Java Web. JavaWeb is developed based on requests and responses.


1.2 Request and Response

A Request is when a client sends data to a server, called a Request.

A Response is when the server sends back data to the client and calls for a Response.

Requests and responses come in pairs, and there is a request and there is a response.


Second, Tomcat server

1. Download Tomcat

Download from tomcat.apache.org/

Select the version to download


2, installation,

Download the Tomcat zip package and decompress it to the required directory.


3. Introduction to tomcat directory

bin Stores executable programs for the Tomcat server
conf Store configuration files for the Tocmat server
lib Stores the JAR package of the Tomcat server
logs Stores the diary information generated when the Tomcat server is running
temp Stores temporary data generated while Tomcdat is running
webapps Stores deployed Web projects
work Tomcat working directory, used to store Tomcat runtime JSP translation into Servlet source code, and Session passivation directory

4. Start the Tomcat server

Bat file in the bin directory of the Tomcat installation directory. Double-click the startup

5. Test whether the Tomcat server is started successfully

Open your browser and type the following address in the browser address bar to test:

  1. http://localhost:8080
  2. http://127.0.0.1:8080
  3. http://ip address: 8080

If the following page is displayed, the Tomcat server is successfully started.


3. IDEA integrates Tomcat server

The operation menu is as follows:

English: the File | Settings | Build, Execution, Deployment | Application Server

Localization: File | Settings | | application server build, implementation, deployment

Configure the Tomcat installation directory:

See if the configuration is successful by creating a Model

Tomcat integration successful


Create dynamic Web projects in IDEA

1. Create a new module

2, 【Java Enterprise】

3. [Servlet]

4. Module files

5. Edit and configure Tomcat

6, you can change the name, default open browser, port number

7. Add artifacts

8. The workpiece is added

9. Click Run

10. A page is displayed, indicating that the startup is successful