Servlet Learning-001-Understanding and Using Tomcat

1. What is Tomcat

First of all, let's look at the explanation of Baidu Encyclopedia. insert image description here
To summarize, tomcat is a middleware. In the B/S architecture (browser/server), the http request sent by the browser is forwarded to the final destination server through the tpmcat middleware, and the response The message is then returned to the browser through tomcat.

2. Download Tomcat

Download from the official website; https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/net
disk link in the comment area, download according to your own preferences

3. Understand the directory structure of Tomcat

We open the tomcat folder
insert image description here

4. Using Tomcat

4.1 Check if Tomcat has been started

a) Enter the bin directory - click the corresponding startup program ( note: do not close the window )
insert image description here
b) Visit tp://localhost:8080/, the following page appears, the visit is successful
insert image description here

4.2 Publish the project using Tomcat

a) Open webapps (web publishing directory file), create a new file
insert image description here
b) Open the examples file, copy the following files to the new directory
insert image description here
insert image description here
c) We mainly edit the index file, we also look at the directory structure of the web-inf file
insert image description here
Edit the index file
insert image description here
d) Restart tomcat, close and open it in the bin directory, visit http://localhost:8080/oakhachi, the result is as follows (oakhachi here is the name of my own newly created folder) I
insert image description here
believe you have probably known our "tom cat" ", If you keep publishing the project like this, it will be a bit too troublesome. In the next chapter, we will use the idea to use Tomcat to publish the project. Of course, the most important thing is to know these basics.

Guess you like

Origin blog.csdn.net/m0_50991874/article/details/122791146