Java Reference
In-Depth Information
action="#{theatreBooker.bookSeat(}" [4]
value="#{_seat.booked ? 'Reserved' :
'Book'}" />
The ui:composition element is a templating tag that wraps content to be included in
another Facelet. Specifically, it will be included in the default.xhtml[1] template.
The creation of the view is done in three steps. First, we will display the customer's
money [2] , which is bound to the session variable called money .
Notice how we directly reference CDI Beans (for example, TheatreBooker ) from JSF
expressions, just as we used to do with JSF Managed Beans.
The next thing on the checklist is printing all JSF messages [3] that are meant to be pro-
duced by the application via the messages element.
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 object:
<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 that has
been produced by a CDI Bean. To be precise, it has been produced by TheatreInfo
that, as we have seen, has a @Produces and @Named annotation on our list of seats:
Search WWH ::

Custom Search