Create Struts form beans
You can create a Struts form bean class and its entry in the Struts configuration file.
Create a Struts enabled Web project or enable an existing Web project with Struts support.
A form bean is a type of Java bean. A form bean is an instance of a subclass of an ActionForm class. This bean stores HTML form data from a submitted client request or can store input data from a Struts action link that a user clicked.
A form bean is an instance of a subclass of an ActionForm class, which stores HTML form data from a submitted client request or that can store input data from a Struts action link that a user clicked. A form-bean mapping is an entry in a Struts configuration file that maps the form-bean name to an ActionForm class.
To create a Struts form bean:
- In Enterprise Explorer of the Web perspective, right-click the name of a Struts project or a resource in a Struts project.
- On the pop-up menu, click
New | Other | Web | Struts | ActionForm Class | Next.
- On the New ActionForm Class page in the ActionForm class name field, type the name of the ActionForm subclass that you are creating.
- Fill out the other fields as appropriate for the subclass you are creating, and click Next.
- On the Create new fields for your ActionForm class page, click Add and type the name and type of each field that you want to create.
- If you want to accept the default values, click Finish. A form-bean entry is added to the Struts configuration file.
- If you want to change the default values, click Next.
- On the Create a mapping for your ActionForm class page:
- If you want to create a form bean mapping, be sure that the Add new mapping check box is selected, and that the names of the configuration file and the mapping are correct.
- If you do not want to create a form bean mapping, clear the Add new mapping check box.
- Click Finish