Lesson 5: Edit a form bean
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.
- In the Enterprise Explorer, double-click the dateData form bean in the /computeDay node to open the form bean in the Java editor.
- In the editor, find the following line of code:
ActionErrors errors = new ActionErrors();
- Immediately below this line, insert the following code:
if (year < 1582) { errors.add("year", new org.apache.struts.action.ActionMessage ("pre_gregorian")); }
- Save and close the
DateData.java file.
- In the Enterprise Explorer, double-click
DayOfWeek | Java Resources: src | com.ibm.dayofweek.resources | ApplicationResources.properties
- In
ApplicationResources.properties, remove the # character from the lines that begin with errors.header and errors.footer.
- Add the following code to the end of the file:
pre-gregorian=<li>Date is before 1582, the year the Gregorian calendar began</li>
- 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:
- Locate the source file for the form bean.
- Edit the source code.