Java Reference
In-Depth Information
1. First, we will display the customer's money
[2]
, which is bound to a ses-
sion variable called
money
.
Note
Notice how we directly reference CDI Beans (for example,
TheatreBookerBean
) from JSF expressions, just like we used to do
with JSF Managed Beans.
2. The next thing on the checklist is printing, via the messages element, all
JSF messages
[3]
that are meant to be produced by the application.
The main task of this view is to produce a view of all tickets and let the users
purchase them. This is achieved by means of a
dataTable
object
[3]
that can
be used to produce a tabular list of objects, which are generally stored as
java.util.List
in your beans.
Pay attention to the value attribute of the
dataTable
:
<h:dataTable var="_seat" value="#{seats}"
rendered="#{not empty seats}"
styleClass="simpletablestyle">
In this case we don't directly reference a CDI Bean, but we reference an object,
which has been "produced" by a CDI Bean. To be precise it has been produced by
TheatreInfoBean
, which as we have seen, has a
@Produces
and a
@Named
an-
notation on our list of seats:
private List<Seat> seats;
@Produces
@Named
public List<Seat>getSeats() {
return seats;
}