Struts + XDoclet (webdoclet) and integration with Eclipse

5

XDoclet and Eclipse

First we have to install the JBoss-IDE plug-in. In Eclipse, go to Help -> Software Updates -> Find and Install and select “Search for new features to install”. Add a new remote site with URL http://jboss.sourceforge.net/jbosside/updates. From here on the installation is straightforward, but if you need more help, you may want to look in the Quick Start Guide.

Now if you right-click on your project, you’ll notice some new menu items: “Run XDoclet”, “Run Packaging” and after seletion of “Properties”, you’ll see “XDoclet Configurations”. When you click on the latter, the XDoclet configurations associated to your project will become available:

JBoss-IDE in Eclipse

Warning: do not be alarmed if it is still empty, you start out with an empty configuration by default!

Now by right-clicking in the upper pane, you can add a configuration. We choose standard here, and select the Standard Web configuration (which corresponds to the webdoclet module). Similarly, one may choose Standard EJB when the ejbdoclet module is needed.

Right-click on the “webdoclet” module in the lower-left pane and choose “Add”. Here we can add tasks such as “strutsconfigxml” and “strutsvalidationxml”, which correspond to the entries in the Ant build file, of course! After adding these elements, we can select them in the lower-left pane and edit the associated attributes in the lower-rigth pane (double click on an attribute to change its value).

In my case, I merely had to adapt the “destDir” attribute of the “webdoclet” and “deploymentdescriptor” elements, the “mergeDir” attribute of “webdoclet” as well as the “dir” attribute of “fileset” to my project structure, but it may be cleaner to set all the attributes according to the above Ant build file excerpt.

These actions result in a build-xdoclet.xml file being added to your project. Going back to your project, you may now activate the “Run XDoclet”, which generates your web.xml, as well as your struts-config.xml. If you added “strutsvalidationxml” to your XDoclet configuration, the validation.xml is generated as well.

Tip: If you get errors during “Run XDoclet” (Can’t create a strutsconfigxml element under webdoclet…[cut]), you may have to add the xdoclet-apache-module-x.y.z.jar to your $ECLIPSE_HOME/plugins/org.jboss.ide.eclipse.xdoclet.core_x.y.z directory.

1 2 3 4
Share.

About Author

5 Comments

  1. Pingback: Credit Report Offers

  2. Pingback: Tripods For Less

  3. Pingback: Debt Consultation

  4. Hi,
    I have some problem, how to generate tiles-def.xml using Xdoclet1.2.
    Please give me any suggestion regarding this issue ASAP.