JBoss.orgCommunity Documentation
JBoss Tools provides the following functionality when working with Struts:
Create new Struts projects
Import (open) existing Struts projects. You can import any project structure
Add Struts capabilities to any existing Eclipse project
Import and add Struts capabilities to any existing project created outside Eclipse.
Now, we'll focus on all these points more fully.
JBoss Tools provides a New Struts Project Wizard that significantly simplifies the process of creating a new Struts project. You just need to follow these steps:
Select
→ → from the menu bar. Then, select → → from the dialog box. Click the button:On this form, provide the Project Name. You can also select where to create the project, or use the default path.
The Struts Environment sets the Struts version that will be used.
Don't put spaces in project names since some operating systems may experience problems processing and searching for these files.
You can select the KickStart template, which results in a project that includes a simple Hello World type application that is ready to run.
Next, you register this application with the current servlet container defined for your workspace (JBoss AS, by default) in order to allow you to easily test your application while still developing it. A new entry will be added in the servlet container configuration file to enable the application to be run in-place (called null deployment or link deployment). Uncheck the "Target Server" check box if you prefer not to register your application at this point.
On the next form, you can select the TLD files to include in this project:
After the project is created, you should have the following project structure (if you used the KickStart template):
If you want to hide the JAR files from Web App Libraries in view, select the down-pointing arrow in the upper right corner, select
, check the box next to Name filter patterns (matching names will be hidden), and type *.jar into the field. Then, click the button.For detailed information on migration projects to JBoss Developer Studio see the Migration Guide.
This section will describe how to add Struts functionality (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 Tools editors, such as the Struts configuration editor and the JBoss Tools JSP editor. To take advantage of this just right-click the project and select → from the context menu. This will start the process of adding all the necessary Struts libraries and files to your existing project.
In the wizard you should point to the location of your deployment descriptor file web.xml
and name of the project.
After clicking the 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, click the button.
Here you can select which Struts Version, Servlet Class, URL Pattern and TLDs to add to this project.
When done, you will see the default Struts module configuration information. See how to Edit Struts modules.
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) to be automatically added to your project, tick the Add Libraries checkbox.
When done, you can open and edit the struts-config.xml
file using useful Struts configuration file editor provided by JBDS. (The Struts configuration is shown below in the Tree viewer).