Java Reference
In-Depth Information
As you might remember from the earlier chapter, the conversation scope is a bit
like the traditional session scope, in that it holds the state associated with a user of
the system and spans multiple requests to the server. However, unlike the session
scope, the conversation scope is demarcated explicitly by the application. Therefore,
you can set the boundaries of your conversation and unload objects from memory
once your conversation has ended.
Adding a controller to drive user requests
The link between the Persistence layer and the user's view falls to the TicketCon-
troller bean, which will drive requests to the actual services exposed by our ap-
plication. Since this bean will be bound to RequestScope and we need to expose it
to our views as well (using @Named ), we can use the convenient @Model annotation
for it, which is a sum of these two attributes.
@Model
public class TicketController {
@Inject
private FacesContext facesContext;
@Inject
private TicketService ticketService;
@Inject
private List <SeatType> seatTypes;
@Inject
private Conversation conversation;
@Produces [1]
@Named
private SeatType newSeatType;
@PostConstruct
public void initNewSeatType() {
newSeatType = new SeatType();
Search WWH ::




Custom Search