Use this lesson to learn how to create a form bean.
A form bean is a type of Java bean.
The form bean stores HTML form data from a submitted client request
or input data from a Struts action link that a user clicked.
To
create a form bean:
- In the diagram, hold the mouse pointer over the /computeDay action
and click Add Form Bean. The Form Bean Selection dialog
opens.
- In the Form Bean Selection dialog,
click New. The New Form Bean wizard
opens.
- In the Form Bean Name field, type dateData.
- Click Form Bean Type to create the
form bean type specified by the class. The New
ActionForm Class dialog opens.
- Click Next.
- On the Create new fields for your ActionForm
class page of the wizard, click Add to
add the following fields:
| Name |
Type |
| year |
int |
| month |
int |
| day |
int |
| dayOfWeek |
String |
Then click Finish.
- In the New Form-Beam page of the New
Form-Bean dialog, click Finish. The Form Bean Selection dialog displays
the form bean that you just created.
- In the Form Bean Selection window,
select dateData, then click OK. The /computeDay node is updated with
the form bean.
The dateData form bean is added to the /computeDay node,
and the dateData.java file is created in DayOfWeek\Struts\<default
module>\Form Beans.
At the end of this lesson, the Enterprise Explorer looks
like this: