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 IDEA
After selecting the red box, click to next
select the location and project name. Then clickfinish
Focus:找到刚才新建的Java项目,然后右键,点击 Add Framework Support...
Then check Web Application and click ok
This time the Java web project is created
2. Configure Tomcat
Click Run
-> in the navigation barEdit Configurations...
Click + Add, scroll down to find Tomcat
and select according to the annotations on the map. Configure...
After clicking, select the Tomcat installation path
. If there is an error below, click Fix directly. Due to the lack of a jar package, click Fix to get it directly.
Then click ok and the configuration is successful (because I have already configured it, it directly prompts that it already exists)
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
running ) and then IDEA becomes like this after clicking run.
Successfully tested interface.
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.