Your First Cup: An Introduction to the Java EE Platform

ProcedureAdding Properties to the Bean

During this task, you will add the following properties to the DukesBDay bean:

  1. After the dukesBirthday variable declaration, add the following private variables:


    private int age;
    private Date yourBD;
    private int ageDiff;
    private int absAgeDiff;
    private static Logger logger = Logger.getLogger("firstcup.web.DukesBDay");
  2. Initialize the variables by adding a default constructor:


    public DukesBDay() {
    	age = -1;
    	yourBD = null;
    	ageDiff = -1;
    	absAgeDiff = -1;
    }
  3. Right-click in the editor and select Format.

  4. Right-click in the editor and select Fix Imports.

  5. Select java.util.Date for the Date class, java.util.logging.Logger for the Logger class, and click OK.