Use Eclipse to create a simple web project called eclipseweb
Eclipse neon Chinese edition;
1. Right-click New --> select Dynamic Web project
2: Enter the project name and project location. Select Dynamic web module version and tomcat version. Click Finish to create a project;
2.1: Project name;
2.2: Project location;
2.3: there is a Version matching relationship between Dynamic Web Module Version and Tomacat Version: the matching relationship is as follows:
3: The project structure after the creation is successful:
4: Check the properties of the project after creating the project structure:
4.1: view the project path (what path is the path here? Guess.); Project location (Where is the location here? Guess); project code: UTF-8;
4.2 check the project structure: (did you find the version in the red box? Guess what they have to do with it? )
4.3 project Deployment: Web Deployment Assembly (web Deployment Integration) is mainly used to configure the web Deployment directory. (what is the impact of this Deployment directory? Guess !)
4.4 Java compiler: if this is inconsistent with the JDK version you set, your project compilation will fail.
4.5 Java build path: (guess what the build path means? What will it affect? If you cannot guess it, click the Add folder indicated by the arrow and open the directory structure after clicking it. I believe you will understand it );
This is what the above attributes mean in step 1. in this way, you can better understand the entire project structure, and if there are path problems such as 404 after startup, your answer may be in a configuration above;
5: Create a page index under the WebContent directory. jsp (that is, it is at the same directory level as web-Info) (Note: The location must be under the WebContent directory to guess why ?)
The index. jsp name can be used as needed;
Enter helloWorld in index. jsp!
The directory structure is as follows:
6. Deploy and run a web project:
6.1 select the server my tomcat 9
7. Click Finish to run:
Console information: Indicates That tomcat has been started.
8: Enter the address in the address bar of the browser: localhost: 8080/web02/(note: the address here is only for the Project address, and can be accessed without the page address. guess why? If you add a welcome. jsp page, can you directly enter the Project address and directly access index. jsp? You can try it by yourself. Then you can guess why ?)
Hello World! is displayed on the page!
Congratulations! You have created a simple web page.