Java Reference
In-Depth Information
Coding the beans
Once your project is properly configured, we can start modeling our beans. The first
bean we will upgrade is
TheatreBookerBean
which will drive the user session, ac-
cessing the
Ticket
list from our
TheatreBox
bean:
package
com.packtpub.as7development.chapter4.service;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import org.jboss.logging.Logger;
import
com.packtpub.as7development.chapter4.ejb.TheatreBox;
import
com.packtpub.as7development.chapter4.model.Seat;
@Named [1]
@SessionScoped [2]
public class TheatreBookerBean implements
Serializable {
private static final Logger logger =
Logger.getLogger(TheatreBookerBean.class);
int money;
@Inject TheatreBox theatreBox; [3]