IDEA2017.3.3 create the first javaweb project and tomcat deployment practices,
1. Create a simple web project
File --- New --- Project
1. select jdk (the jdk path found through java-verbose is on disk C, which cannot be identified here, when I install jdk, I have my own path on disk D. After the import, It is jdk1.9 in the figure)
2. click next.
3. You don't need to select anything. next
4. webDemo-finish
2. Create a Module
1. Select the new project webDemo, right-click and choose new-module
2. The Module SDK is the same as before. Select Web Application and next
(Web. xml is missing here and will be created later)
3. Name it firstWeb, finish
4. file -- project structure -- facets -- select the sub-directory
5. Click the plus sign on the Right of deployment descriptors -- OK
The directory structure is
6. Create the classes and lib folders under the WEB-INF
Classes is used to store compiled class files. lib stores third-party jar packages.
7. Configure the folder path
File -- Project Structure -- Modules -- Paths -- change both Output path and Test output path to the classes folder path.
8. Select Dependencies and click the plus sign on the right -- JARs or directories.
Select the created lib folder
Select jar Directory -- OK
3. Configure the tomcat container
1. run --- Edit events...
Click "+" Tomcat Server --- Local
Enter the server name in Application server ---- click configure next to the name...
In the pop-up window, click "..." next to Tomcat Home, and select the tomcat installation directory.
Set HTTP port and JMX port
4. Deploy and run on tomcat
After creating tomcat, you can quickly open the tomcat configuration page through the toolbar.
Go to the newly created tomcat configuration page
Select deployment, click the plus sign on the right, and select Artifact.
Enter Application context ---- apply
Return to the server panel and change On 'update' action and On frame deactivation to Update classes and resource ---- apply.
Develop a web project and run tomcat
Edit index. jsp
Running result
Perfect!
(That is, there is a picture that is not easy to face, can not move, the word is written smaller, should not be seen)