Convert ordinary projects to web projects in Eclipse

When learning, sometimes you need to create a new project, write some java code, and prepare to write the web part, eh? What about my WebContent? Then I found myself building the wrong project. So, go ahead and create a new one. Copy the written part of the code. Very stupid!

 

In fact, there is a very easy way to convert an ordinary project into a web project.

 

Here is the normal project:


 

 1. Right-click to open the project properties Properties: shortcut key (alt+enter)



 

2. Select Project Facets.

 

3. Select Convert to Facets to form.


 

4. Select " Dynamic Web Module " and " Java ", check the version you need.



 

5. At this point, click OK (Eclipse will generate files corresponding to the web project under the "WebContent" folder by default (for example: WEB-INF, web.xml).

If you need to change the path of these files, you can click " further configuration available... "


 

6. You can change the path, remember to let it generate web.xml. Don't wait to build it yourself.



 

7. Done. I did not change the path to store: WEB-INF, web.xml, or the default. Then the structure is the same as the web project we built.


 

*There may be a wrong version of Dynamic Web Module , so please change the version. I just ran into it, but changing a version will do.
 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326783972&siteId=291194637