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.
- In the Form Bean Selection dialog, click New.
The New Form Bean wizard opens.
- In the Form Bean Name field, type dateData.
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 Next.
- On the Create a mapping for your ActionForm class page
of the wizard, in the Java package field, type com.ibm.dayofweek.
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: