How to create a Java web project and configure Tomcat server in IDEA2020 version

After the IDEA2020 version is updated, the creation of a Java web project is a little different from before. When I first came into contact with it, I found many old tutorials, but they were not created successfully. Finally, I saw the new version of the tutorial on Uhuwa and recorded it.

1. Create a Java Web project

Create a new ordinary Java project after opening IDEAInsert picture description here

After selecting the red box, click to next
Insert picture description here
select the location and project name. Then clickfinish
Insert picture description here

Focus:找到刚才新建的Java项目,然后右键,点击 Add Framework Support...Insert picture description here

Then check Web Application and click ok

Insert picture description here

This time the Java web project is created

2. Configure Tomcat

Click Run-> in the navigation barEdit Configurations...

Insert picture description here
Click + Add, scroll down to find Tomcat
Insert picture description here
and select according to the annotations on the map. Configure...After clicking, select the Tomcat installation path
Insert picture description here
. If there is an error below, click Fix directly. Due to the lack of a jar package, click Fix to get it directly.
Insert picture description here
Then click ok and the configuration is successful (because I have already configured it, it directly prompts that it already exists)
Insert picture description here

3. Run the project after the configuration is complete

Click the project root file, and then click Run Tomcat 8.5.57(you can change the .jsp file in the web folder of the project before
Insert picture description here
running ) and then IDEA becomes like this after clicking run.
Insert picture description here
Successfully tested interface.
Insert picture description here
Note: Do not start Tomcat before IDEA starts the project. This will occupy port 8080 and report an error. Stop the Tomcat service and run it directly in IDEA.

Guess you like

Origin blog.csdn.net/weixin_43716048/article/details/108639475