2.2.1.3. Adding Struts Capability to an Existing Web Application

With JBoss Developer Studio you can add Struts capabilities (including Struts libraries, tag libraries and a Struts configuration file) to any existing Web application project in your Eclipse workspace. By adding a Struts Nature to your project, you can now edit files using JBoss Developer Studio editors, such as the Struts configuration editor and the JBoss Tools JSP editor.

To add Struts Nature to your existing Project right-click the project and select JBoss Tools > Add Struts Capabilities from the context menu. This will start the process of adding all necessary libraries and files to make this a Web Struts project.

Adding Struts Capabilities

Figure 2.66. Adding Struts Capabilities


In the wizard you should point to location of your deployment descriptor file web.xml and name of the project.

Choosing Project Location

Figure 2.67. Choosing Project Location


After hitting Next, you will see the following screen. This screen simply means that you need to add at least one Struts module to your project to make this project a Struts project. Adding a Struts module means that a new struts-config.xml will be added to your project and registered in the web.xml file. In addition, all required Struts libraries will be added. To add a Struts module, select the Add Struts Support button.

Project Modules

Figure 2.68. Project Modules


Here you can select what Struts Version, Servlet Class, URL Pattern and TLDs to add to this project.

Selecting Struts Support Options

Figure 2.69. Selecting Struts Support Options


When done, you will see the default Struts module configuration information. See how to Edit Struts modules.

Project Configuration Information

Figure 2.70. Project Configuration Information


On the last screen you can set the different folders for your project as well as register this application with a servlet container. If you want the libraries (.jar files) will be automatically added to your project, click on the checkbox Add Libraries.

Registering the Project at Server

Figure 2.71. Registering the Project at Server


When done, you can open end edit the struts-config.xml file using usefull Struts configuration file editor provided by JBDS. (The Struts configuration is shown below in the Tree viewer).

Struts-config.xml File

Figure 2.72. Struts-config.xml File