Quantcast
Viewing all articles
Browse latest Browse all 10

How to add Struts Capabilities or Dynamic Web Project on Eclipse without using context menu

How to add Struts Capabilities or Dynamic Web Project on Eclipse without using context menu

Hi All,
I just want to share how to add the struts capabilities without using the JBossTool > add/remove struts capabilities context menu.
In some cases these process have some unknown problems. So here we go.

1. Go to your Eclipse project folder and you should see a file named “.project” open the file.
2. Search for these lines

<natures>
  <nature>org.eclipse.jdt.core.javanature</nature>
</natures>

3. Change those lines to become

<natures>
  <nature>org.eclipse.jdt.core.javanature</nature>
  <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
  <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
</natures>

save the changes you have made.
4. Open one more file called “org.eclipse.wst.common.component” under your “.settings” folder inside your Eclipse project folder. If there is no “.settings” folder inside your project or empty one, you can use from other Eclipse Struts Project, just copy it over.

5. Change the some parameters

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="application_name">
        <wb-resource deploy-path="/" source-path="/web"/>
        <property name="context-root" value="application_name"/>
        <property name="java-output-path"/>
    </wb-module>
</project-modules>

Pay attention to (you can ignore other, the application_name usually the Eclipse project name) :
the source-path is relative to the location of your .java files.
the deploy-path is relative to the location of your .class files.
the context-root is the application name, usually the war name or the war-extracted folder name on the server.
4. Close your Eclipse project and open it again.
5. Right click on your project and go to the Properties menu.
6. Choose the Project Facets, select Dynamic Web Module and Java by active the checkbox
respectively(for my case i choose version 2.5 for the Dynamic Web Module and 5 for Java). Click OK.

That`s it, i hope it useful. Feed back is very welcome.


Viewing all articles
Browse latest Browse all 10

Trending Articles