Creating Struts actions
This documentation describes how to create a Struts action and optionally create an action mapping.
An action is an instance of an Action subclass that implements a portion of a Web application and returns a forward. An action mapping is a configuration file entry that, in general, associates an action name with an action.
To create an action and optionally create an action mapping, complete the following steps:
- In the Project Navigator of the Web perspective, right-click the name of a project.
- Left-click New > Other > Web > Struts > Action Class > Next. The New Action Class wizard starts.
- On the New Action Class page, complete the following steps:
- In the Java package field, specify the name of the Java package in which the class is to be created.
- In the Action class name field, type the name of the new action.
- If you want to specify modifiers that apply to the new class, select one or more of the following boxes: public, abstract, final.
- Make sure that a value is supplied in the Superclass field.
- For each interface that you want to create, click Add and type the interface name, the names of matching types, and any qualifiers.
- If you want to create method stubs, click the check boxes to select the ones you want.
- For the code generation model, select Generic Action Class.
- Click Next.
- If you want to create an action mapping in addition to creating an action, leave the Add new mapping box checked on the "Create a mapping for your Action class" page, and complete the following steps:
- Make sure that a configuration file name is specified.
- If you want to change the default mapping path, type the path name in the Mapping Path field.
- If you want forwards in addition to the defaults, click Add and type the name and path of the new forward.
- To delete a forward, select the forward name and click Remove.
- If you want to specify a form bean, select the name from the Form Bean Name drop-down menu.
- If you want to specify a form bean scope, from the Form Bean Scope drop-down list select request or session. The default behaves as if request were selected.
- Click Finish.
Related concepts
Struts actions and action mappings
Struts development tools
Related tasks
Creating Struts action mappings
Creating Struts form beans
Creating well-architected Web applications using Struts
Feedback