Creating Struts configuration files

 

+

Search Tips   |   Advanced Search

 

A Struts configuration file is an XML document that describes all or part of a Struts application. A Struts configuration file is created automatically when you create a Struts project or a Struts module. Normally, one configuration file exists for each module. However, for compatibility with older versions of the Struts standard, you can have more than one configuration file for the default module.

A Struts configuration file contains the following tabs:

Struts 1.0 supports only action mappings, global forwards, form beans, and data sources.

To have an effect, a Struts configuration file must be referenced from the Web deployment descriptor (web.xml file) for the configured Struts action servlet.

The Struts configuration file editor in the workbench is designed specifically to edit Struts configuration files. The XML editor has been enhanced to use the configuration file DTD.

If you create just one Struts configuration file, its default name is struts-config.xml

To create a Struts configuration file:

  1. In the Enterprise Explorer, right-click the WEB-INF folder.

  2. In the pop-up menu, click New | Other.

  3. In the New window click Web | Struts and then Struts Configuration File.

  4. Click Next. The New Struts Configuration File wizard starts.

  5. In the File Name field, type the name of the Struts configuration file that you want to create, and click Finish.

To ensure that the definition in the new configuration file can be found by your application, configure the Struts action servlet to refer to this configuration file in web.xml.