Adding Struts support to dynamic Web projects
You can add Struts support to a dynamic Web project when you create the project or afterward. When you add Struts support, you can customize the Struts version, default Java package prefix, and resource bundle information.
To add Struts support when you create a project, see Creating a dynamic Web project. Adding Struts support to a static Web project is not supported, nor is customizing the Struts feature after Struts support has been added.
To add Struts support to an existing dynamic Web project:
- In the Project Navigator, select a project name, right-click the name, and click Properties.
- On the Properties page, click Web Project Features, check the Add Struts support box, and click Apply.
- If you want to override the default Struts settings, on the Struts Settings page click the Override default settings box and specify the following settings:
Setting Description To specify a different version, select from the "Struts version" drop-down menu. This determines which .jar and .tld files will be copied to the workspace: those for Struts 1.1 (default) or those for Struts 1.0.2. Note: Whatever version of Struts you select for your project becomes the default for your subsequent Struts projects.
To change the default Java package prefix, edit the "Default Java package prefix" field. This is the package prefix to be used for Java classes that are generated for you. You may wish to change it if, for example, you have an existing package and would like all generated code to go to that package, or if the default conflicts with a package that you currently use and you do not want the code to be generated there. To create a resource bundle for your Struts project, make sure that the "Create a Resource Bundle for the Struts Project" box is checked and that a Java package name and a resource bundle name are specified. This setting defines the resource bundle that your Struts application will use. If you specify this option, a resource bundle is created and a reference to it is added to the project's struts-config.xml file. If a resource bundle exists, your application will look up strings there. If you want to enable national language support (NLS) for your Struts application, you simply add another bundle in the translated language to the same directory and name the bundle appropriately; the Struts framework automatically handles the locale change. You may not want a resource bundle created if you have an existing resource bundle that you plan to reuse or if for some other reason it does not make sense to create a resource bundle. - Click Finish. The wizard adds a Struts entry in the web.xml file, creates a Struts configuration file, and adds JAR files to the dynamic Web project.
- On the Properties page, click OK.
Related concepts
Struts development tools
Related tasks
Creating a dynamic Web project
Creating a Struts portlet project
Creating well-architected Web applications using Struts
Related reference
Feedback
Preferences for Struts and Struts development tools