Java Reference
In-Depth Information
. You've now started a conversation and have also cached the item the user has
item
selected.
The final responsibility of the
startConversation
method is to transition to the item
page. The response is rendered within the current request so the cached item is still avail-
able. The page displaying the selected item is shown in
listing 12.18
.
When this page is
rendered, the
selectedItem
is retrieved from the
getCurrentItem
method .
This is a producer method, and it returns a selected item that's conversationally scoped and
thus survives until the conversation is ended. The conversation can be ended either pro-
grammatically or through expiration from inactivity.
Listing 12.18. Item page—view and bid
In this listing the name of the selected item is displayed . This requests the selected item
of the bid is captured using an input field . Clicking the Command button causes the
amount to be recorded and a confirmation page to be displayed. The
placeOrder
meth-
od call causes the placeBid.xhtml page to be displayed, which summarizes the bid and has
a button for confirming the details and finalizing the bid. The code for
placeOrder
is
contained within the
BidController
, as shown in the next listing.