The Java Project You just created is like this
Right-click the project name to find this place
Modify the Default output folder below to vehicle-report/webcontent/web-inf/classes
Page-related HTML files, CSS files, JS files should be placed under the webcontent
Web-inf is a directory that is not visible to clients, and is typically used to store Java file compiled class files, jar packages, required Web. XML
<?XML version= "1.0" encoding= "UTF-8"?><Web-appID= "webapp_id"version= "2.4"xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <welcome-file-list> <Welcome-file>index.jsp</Welcome-file> </welcome-file-list></Web-app>
Go to the Web-inf level, create the Lib folder, put in the jar package you need to use, and put in a copy of Web. Xmlcopied from elsewhere (modify welcome-file as needed)
Introduce the jar package in Eclipse, select the jar package under the Lib folder, right-click build Path-add to build Path
If you are developing a JSP application, Servlet-api.jar is a must, and the project structure becomes the same after the introduction.
A Web application that can be accessed is almost done , and then we need to deploy the project to a Web container, such as Tomcat
Locate the installation directory for Tomcat and go to the WebApps folder (if not by changing the Tomcat configuration, which is the default folder for Web project files), create a new folder named after the project name
Copy All files in the Web Project WebContent folder to the new folder under WebApps
Go back to the Tomcat installation directory, go to the Bin folder, execute startup.bat, and open the Tomcat service
After the service starts, open the browser, enter http://localhost:8080/Vehicle-Report/ , you can see the effect.
The Java project in eclipse is converted to a Web project