Java Reference
In-Depth Information
The next listing shows the code that kicks off the long-running conversation.
Listing 12.17. ItemController —starting a conversation
This listing contains the code for the ItemController and specifically the
startConversation method
referenced in listing 12.16 . There are a couple of im-
portant things to recognize:
• It is accessible to JSF EL expressions, as you saw in listing 12.16 .
• It operates on an injected Conversation object.
• It “produces” the current selected item that then lives in the conversation.
The @Model annotation marks that this bean is accessible from JSF and that it
has a request-scoped lifecycle. The @Model annotation is a stereotype and is shorthand
for @RequestScoped and @Named . This is a common combination. Prior to the
startConversation method being invoked from the command link, the CDI contain-
er injects a conversation object . To start the conversation, you must explicitly tell the
container that you're starting a conversation, which is done in the startConversation
method
. At the same time, you cache the item the user has selected
in property
 
Search WWH ::




Custom Search