First, create a simple Web project
1. Create a Web project
Choose Project SDK 1.8 (already equipped with environment variables), File--New project--Do not select the Next
2, create Project from Template page, (Can not tick, tick will create demo code), Next
3. Enter project Name: Demo--Next to Finish
4. Created an empty project
Second, create a module
1, the mouse point in the project name of the demo-right select New, select Module---module SDK selection 1.8, check Web application (3.1) Under Java EE, note that the window version corresponds to 3.1, and Create Web. XML is checked and Next
2. Input module name is Demoweb, Finish
3. Create a good Web project
4. Create two folders under the Web/web_inf directory: Classes and Lib
Classes is used to store the compiled output class file, Lib is used to store the third-party jar package
"Web-inf", "New", "right", "Directory"
Create a good folder
5. Configure Folder path
File--Project Structure (CTRL + SHIFT + ALT + s) or use the toolbar's shortcut, select modules
Select paths, select "Use module compile out path" to set the OutputPath and test output path to the classes folder you just created
Select the dependencies of the current window, and select "1 JARS or directories ..." by selecting the module SDK as 1.8, click on the + sign on the right.
, select the Lib folder you just created, OK
Select Jar Directory, OK
, Apply, OK
Iii. Configuring the Tomcat container
1. Open menu run, Edit configurations ... Or use the toolbar's shortcut keys
2. Click "+", select "Tomcat Server", select "Local", if there is no "tomcat" option, expand "Items More"
3. Enter a new server name at name, click "Configure ..." after "Application Server", pop-up Application Servers window, select the locally installed Tomcat directory in Tomcat Home Ok
4. In the "Run/debug Configurations" window, enter the name of the server Tomcat, in the "Server" panel, uncheck "After Launch", set "HTTP port" and "JMX port" (default), click Apply, OK,
Now that the Tomcat configuration is complete (the small Red fork on the Tomcat icon in the list on the left is a hint that the project is not deployed and will disappear when the project is deployed).
The port number of the site can also be modified according to its own wishes.
Iv. deploy and run the project on Tomcat
1. After creating tomcat, you can quickly open the Tomcat Configuration page via the toolbar,
You can also use the menu bar: Run, Edit configurations ..., select the tomcat7 you just created, select deployment, click the "+" sign on the right, and select Artifact
2, select Web project, application context can be filled "/demoweb" (also can not fill), Apply
3. Go back to the server panel and change the on ' Update ' action and the on Frame deactivation (these two options are only available after Tomcat has configured the project) to update classes and resources, apply
V. Developing Web projects and running Tomcat viewing effects
1. Edit Index.jsp Page
2. Running Tomcat
3. Select a browser to open
content reference from:https://www.cnblogs.com/shindo/p/7272646.html
Intellij idea 2016 creating a Web project