New Struts ActionForm Bean Wizard: Name and Location

Use to create a new actionform bean.

An actionform bean acts as a bridge between a JSP page and a Struts action. It captures user input from the JSP pages and delivers it to the action. An actionform bean can also validate the input before passing it on to the action.

Before you can use the New Struts ActionForm Bean 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 ActionForm Bean wizard by right-clicking a web application, choosing New > Other and selecting Struts ActionForm Bean from the Struts category.

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

Element Description

Class Name

Specifies the actionform bean's class name.

Project

Specifies the project of the new actionform bean.

Location

Specifies a folder to house the actionform bean.

Package

Specifies a package within the location to house the actionform bean.

Created File

Specifies the file that will created for the new actionform bean.

Superclass

Specifies the class on which the actionform bean is based. A normal actionform bean is based on either the org.apache.struts.action.ActionForm or org.apache.struts.action.DynaActionForm classes for statically defined or dynamic form beans respectively. If you want to validate the input to an actionform bean using a validator, you have to use one of the following superclasses instead:

  • For static (coded) beans

    • org.apache.struts.validator.ValidatorForm
    • org.apache.struts.validator.ValidatorActionForm
  • For dynamic (declarative) beans

    • org.apache.struts.validator.DynaValidatorForm
    • org.apache.struts.validator.DynaValidatorActionForm

Configuration File

Specifies the Struts configuration file, the struts-config.xml file. If none exists, you cannot create the actionform bean. 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.



Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

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