Java Reference
In-Depth Information
}
}
As you can see, the bean has been tagged as Named [1] , which means that it can
be directly referenced in our JSF pages. The bean is SessionScoped [2] since it
stores the amount of money available to the customer during its session.
Finally, notice that we can safely inject EJBs into our CDI Beans using the Inject
[3] annotation. Also the reverse is perfectly legal, that is, injecting CDI Beans into
EJBs.
Compared with our earlier project, here we don't raise Java Exceptions when the
customer is not able to afford a ticket. Since the application is web based, we simply
display a warning message to the client, using JSF Faces Messages [4] .
The other bean that we still use in our application is TheatreInfoBean , which has
been moved to the producer package, as it will actually provide the application with
the list of available seats:
package
com.packtpub.as7development.chapter4.producer;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.event.*;
import javax.enterprise.inject.*;
import javax.inject.*;
import
com.packtpub.as7development.chapter4.ejb.TheatreBox;
import
com.packtpub.as7development.chapter4.model.Seat;
@Model [1]
public class TheatreInfoBean {
Search WWH ::




Custom Search