javaweb
Knowledge Index
- Introduction to tomcat
- tomcat installation
- tomcat use
- idea integrated tomcat
1 javaweb environment construction
If you want to do good work, you must first sharpen your tools. When we learn javaweb, we first need to build his development environment.
- JDK(Java SE Development Kit)
- IDE integrated development tools: Eclipse or IDEA
- Database: MySQL
- Web server: Tomcat
1.1 Introduction to tomcat
JDK, IDE, and database have been introduced to you before. Let's focus on tomcat.
1.1.1 Overview
Tomcat is the world's most famous lightweight application server based on the Java language. It is a completely open source and free Servlet container implementation. At the same time, it supports the processing of static resources such as HTML and JS, so it can be used as a lightweight Web server.
1.1.2 Download
Download address: http://tomcat.apache.org/
Select the tomcat version (shown in the red box):
Select the file to download (shown in red box):
-
The tar.gz file is the installed version under the linux operating system
-
The exe file is the installed version under the windows operating system
-
The zip file is the compressed version under the window operating system (we choose the zip file)
1.2 tomcat server software installation
-
Directly decompress the current tomcat archive: ( no Chinese, no spaces )
-
Configure environment variables:
The operation of tomcat depends on the java environment:
[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-l5ZQscY1-1649674005949) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639023282 (1)].jpg?Content-Type=image/jpg)
1.3 Directory structure of tomcat
1.4 Start and shut down the tomcat server
-
Start the tomcat server
Find the bin directory in the tomcat directory, find the startup.bat command in it, and double-click to start the server:
1.4.1 Test access to tomcat server
Open the browser and enter in the address bar of the browser: http://127.0.0.1:8080 or http://localhost:8080
1.4.2 Shut down the tomcat server
Find the bin directory in the tomcat directory, find the shutdown.bat command in it, and double-click to close the server:
2 idea integrates tomcat
After we open the idea
Open configuration file
[External link image transfer failed, the source site may have an anti-leech mechanism, it is recommended to save the image and upload it directly (img-HCWUTw3N-1649674005951) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639031390 (1)].jpg?Content-Type=image/jpg)
add server
[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-DxJjNm38-1649674005951) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639031469 (1)].jpg?Content-Type=image/jpg)
Add Tomcat server
[External link image transfer failed, the source site may have an anti-leech mechanism, it is recommended to save the image and upload it directly (img-wclemuKo-1649674005952) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639031619 (1)].jpg?Content-Type=image/jpg)
Add tomcat to the project
[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-SmCzVa3L-1649674005954) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639033252 (1)].jpg?Content-Type=image/jpg)
[External link image transfer failed, the source site may have anti-leech mechanism, it is recommended to save the image and upload it directly (img-vLBTQKbz-1649674005954) (https://itmentu.oss-cn-shenzhen.aliyuncs.com/itmentu/1639033495 (1)].jpg?Content-Type=image/jpg)
So we can add our tomcat, let's learn how to publish
Choose your project
In this way, our configuration is complete, and then we can directly access our tomcat by starting our tomcat directly.