# New Struts Action Wizard: Name and Location

Use to create a new action.

An action responds to a request. Writing an action means subclassing one of the Action classes and then overriding the class's `execute` method. An ActionForward is returned by the `execute` method.

Before you can use the New Struts Action wizard, you must have a Struts configuration file. To create a Struts configuration file quickly and efficiently, right-click the project node, choose Properties and use the Frameworks panel. Not only does this provide you with a Struts configuration file, but you also get the Struts libraries and supporting files.

Once you have a Struts configuration file, you open the New Struts Action wizard by right-clicking a web application, choosing New > Other and selecting Struts Action from the Struts category.

In the Name and Location page, you set the following properties:

Element | Description
--- | ---
Class Name | Specifies the action's class name.
Project | Specifies the project of the new action class.
Location | Specifies a folder to house the action.
Package | Specifies a package within the location to house the action.
Created File | Specifies the file that will be created for the new action class.
Superclass | Specifies the class on which the action is based. This can be one of the following:
`org.apache.struts.action.Action` | An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller (`ActionServlet`) selects an appropriate Action for each request, creates an instance (if necessary), and calls the `perform` method.
`org.apache.struts.actions.DispatchAction` | An abstract Action that dispatches to a public method that is named by the request parameter whose name is specified by the `parameter` property of the corresponding `ActionMapping`. This Action is useful if you want to combine many similar actions into a single `Action` class, in order to simplify their application design.
`org.apache.struts.actions.MappingDispatchAction` | An abstract `Action` that dispatches to a public method that is named by the parameter attribute of the corresponding `ActionMapping`. This is useful if you want to combine many related actions into a single `Action` class.
`org.apache.struts.actions.LookupDispatchAction` | An abstract Action that dispatches to the subclass-mapped `execute` method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the `parameter` property of the corresponding `ActionMapping`.
Configuration File | Specifies the Struts configuration file, `struts-config.xml`. If none exists, you cannot create the action. To create a Struts configuration file quickly and efficiently, right-click the project node, choose Properties and use the Frameworks panel. Not only does this provide you with a Struts configuration file, but you also get the Struts libraries and supporting files.
Action Path | Associates the action with an incoming path. For example, if you type `/login` in Action Path, then whenever the web application receives a request with `/login.do`, the execute method of the associated action is invoked. After completing the New Struts Action wizard, you can modify the action path in the Struts configuration file.

If you click Next, you can let the IDE associate an existing actionform bean with the action. If you click Finish, the action is created on your computer and opened in the IDE.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.