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 default Java™ package prefix and the resource bundle information.

To add Struts support when you create a project, see the related topics. 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:

  1. In the Enterprise Explorer, right-click a project and click

    Properties.

  2. In the Properties list of the Properties page, click

    Project Facets.

  3. Click

    Modify Project. The Project Facets window opens.

  4. Select

    Struts.

  5. Click Finish. Optionally, click Next to override any of the following default Struts settings.

    Setting Description
    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 might 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" check box is selected 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

    struts-config.xml file of the project. 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 might 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.

    Tip:

    This product supports versions 1.0.2, 1.1x, 1.2x and 1.3x of the Apache Struts framework. Struts version 1.0.2 and 1.1.x are supported when an existing project is imported into your workspace. On project creation, select the Struts versions 1.2 or 1.3 facets.

    To modify the Struts version level installed in a project:

    1. Right-click your Web project and select

      Properties | Project Facets. The Project Facets dialog opens.

    2. Select a version level from the Struts version list.

    3. Click OK.

  6. Click OK to close the

    Properties window. 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.