< Previous | Next >

 

 

Lesson 5: Edit a form bean

 

+

Search Tips   |   Advanced Search

 

Use this lesson to learn how to edit the form bean source file and the Java resource file so that they work correctly in your Struts application.

  1. In the Enterprise Explorer, double-click the dateData form bean in the /computeDay node to open the form bean in the Java editor.

  2. In the editor, find the following line of code:

    ActionErrors errors = new ActionErrors();

  3. Immediately below this line, insert the following code:

    if (year < 1582)
    {
      errors.add("year", new org.apache.struts.action.ActionMessage ("pre_gregorian"));
    }

  4. Save and close the

    DateData.java file.

  5. In the Enterprise Explorer, double-click

    DayOfWeek | Java Resources: src | com.ibm.dayofweek.resources | ApplicationResources.properties

  6. In

    ApplicationResources.properties, remove the # character from the lines that begin with errors.header and errors.footer.

  7. Add the following code to the end of the file:

    pre-gregorian=<li>Date is before 1582, the year the Gregorian calendar began</li>

  8. Save and close the file.

 

Lesson checkpoint

In this lesson, you edited the source file of the form bean.

You learned to do these tasks:

< Previous | Next >