Objective:
When you develop a project with Eclipse, importing a Web project into eclipse becomes a Java project and will not run in Tomcat.
Method:
1. Locate the. project file and find the <natures> tag inside to see if there is any code below, and then copy it in.
XML code
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
Note: There is only one sentence in the Java project:
XML code
- <nature>org.eclipse.jdt.core.javanature</nature>
2. Refresh the imported project
3. Right-click on the project, go to Properties configuration, click Project Facets, then click Convert to Faceted form to enter the property settings:
4. Tick the dynamic Web module and Java, select the appropriate version, and click on the further configuration available that appears below:
5. Modify eclipse default WebContent to Webroot, and tick generate Web. XML deployment Deor According to your needs:
5. Click Ok-->apply App Settings, and the Java project is converted for the Web project.
Note: If you forget to click further configuration available, that is, forget to modify WebContent to Webroot,
You can click the Deployment Assembly option, then delete the webcontent and add the Webroot .
Icon:
Create or import:
Modified in:
Modification Completed:
Run in Tomcat:
Note:
The steps for creating a new Web project are the same, except that:
To set Webroot, you can only set it in further configuration available .
cannot be set in deployment assembly .
Technology sharing: www.kaige123.com
How to convert a Java project into a Web project in eclipse