How to convert a Java project into a Web project in eclipse

Source: Internet
Author: User

Objective:

  When you use eclipse to develop your project, importing a Web project into eclipse will become a Java project , you will not be able to run the deployment 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

  1. < nature > Org.eclipse.wst.common.project.facet.core.nature</ nature >
  2. < nature > Org.eclipse.wst.common.modulecore.modulecorenature</ nature >
  3. < Nature >org.eclipse.jem.workbench.JavaEMFNature</nature>

  note: There is only one sentence in the Java project:

XML code

    1. < 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 .

How to convert a Java project into a Web project in eclipse

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.