The Java project in eclipse is converted to a Web project

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.