In this lesson, you will create a form bean. A form bean is a type
of Java™ bean
that stores HTML form data from a submitted client request or stores input
data from a Struts action link that a user clicked.
- Hover over the /computeDay action and click
the Form bean icon.
- The Form bean selection window opens.
- Click New. The New Form-Bean wizard
opens.
- In the Form Bean Name field, type dateData,
then click Next.
- Click Next to skip the Choose
new fields for your ActionForm class panel. This panel allows
you to pull in fields, form information that your pages may already contained
to create your form-bean. Since this is a new application, the pages in this
project does not contain any form information yet. .
- On the Create new fields for your ActionForm class page,
add the following fields using the Add button:
| Option |
Description |
| Name |
Type |
| year |
int |
| month |
int |
| day |
int |
| dayOfWeek |
String |
- Click Next.
- On the Create a mapping for your ActionForm class page
in the Java package field type com.ibm.dayofweek.
- Click Finish.
- You should have and updated Form Bean Selection window.
- In the Form Bean Selection window, click
the dateData form bean you just created, then click OK.
- Double click on the /computeDay action drop down character to show
that this form bean is associated with the action.
The form bean dateData is added to the computeDay node and the actual
resource dateData.java is created in your Web project folder. Navigate to to see
the file.
At the end of this lesson, the Project Explorer should resemble: