Your First Cup: An Introduction to the Java EE Platform

ProcedureAnnotating the class with @ManagedBean and @SessionScoped.

The javax.faces.model.ManagedBean and javax.faces.model.SessionScoped annotations mark the class as a JSF managed bean that is valid for the length of a web session.

  1. Directly above the class declaration, add the @ManagedBean and @SessionScoped annotations.

    @ManagedBean
    @SessionScoped
    public class DukesBDay{
    ...
    }
  2. Right-click in the editor and select Fix Imports.

  3. In the Fix All Imports dialog, select javax.faces.bean.SessionScoped as the fully-qualified class name for SessionScoped and click OK.