< Previous | Next >

Lesson 1.7: Add input and output fields to a JSP

In this lesson you will add the input fields and command buttons to the input.jsp and output fields to the output.jsp.

The input and output fields in a JSP allow users to set the framework for creating dynamic input and output interfaces. The input field is where the user will input the day, month, and year to be and the output field is where the corresponding day of the week will be generated. The input includes the Submit, Refresh, and the output includes the Display an existing record controls for this day of the week tutorial.

To add input fields and command buttons to the input.jsp file:

  1. In your Web diagram, double-click input.jsp. The file opens in Page Designer.
  2. Click Window > Show View > Other.
  3. Expand Web > Page Data, then click OK. The Page Data view displays at the bottom.
  4. Expand Struts Form Beans. The dateData form bean and the fields you defined display.
    Page Data view
  5. Drag the day, month, and year fields from the Page Data view to input.jsp. The Insert Data Object window opens.
  6. Under Create controls for click Updating an existing record.
  7. Click Options and ensure that the Submit and Delete buttons are checked, then click OK.
  8. Click Finish. The form's input fields are created along with Submit and Reset buttons.
    Input fields: day, month, year
  9. Save and close input.jsp.
Describe or show the results of the steps they just followed.

To add output fields to the output.jsp file:

  1. In your Web diagram, double-click output.jsp. The file opens in Page Designer.
  2. In the Page Data view, expand Struts Form Beans.
  3. Drag the dayOfWeek field from the Page Data view to output.jsp. The Insert Data Object window displays.
    Insert data object panel
  4. Click Options and ensure that the Submit and Delete button are checked.
    Options panel
    1. Click OK
  5. Under Create controls for click Displaying an existing record, then click Finish. The output fields are created.
  6. Save and close output.jsp.

Lesson checkpoint

In this lesson you added the input fields and command buttons to the input.jsp and output fields to the output.jsp.

You learned to:
  • Open and work in the JSP file.
  • Add the input and output fields to a JSP
< Previous | Next >