Java Reference
In-Depth Information
Adding a controller to drive user requests
The link between the persistence layer and the user's view falls on the
TheatreSetupService bean, which will drive requests to the actual services exposed
by our application. Since this bean will be bound to RequestScope and we need to ex-
pose it to our views as well (using @Named ), we can use the convenient @Model annota-
tion for it, which is a sum of the following two attributes:
public class TheatreSetupService {
private FacesContext facesContext;
private TicketService ticketService;
private List<SeatType> seatTypes;
@Produces [1]
private SeatType newSeatType;
public void initNewSeatType() {
newSeatType = new SeatType();
public String createTheatre() {
return "book";
public String restart() {
return "/index"; [4]
Search WWH ::

Custom Search