Java Reference
In-Depth Information
Chapter 25. Duke's Bookstore Case Study Example
The Duke's Bookstore example is a simple e-commerce application that illustrates some of
the more advanced features of JavaServer Faces technology in combination with Contexts
and Dependency Injection for the Java EE Platform (CDI), enterprise beans, and the Java
Persistence API. Users can select books from an image map, view the bookstore catalog,
and purchase books. No security is used in this application.
The following topics are addressed here:
• “ Design and Architecture of Duke's Bookstore on page 471
• “ The Duke's Bookstore Interface on page 472
• “ Running the Duke's Bookstore Case Study Application ” on page 477
Design and Architecture of Duke's Bookstore
Duke's Bookstore is a simple web application that uses many features of JavaServer Faces
technology, in addition to other Java EE 6 features:
• JavaServer Faces technology, as well as Contexts and Dependency Injection for the
Java EE Platform (CDI):
• A set of Facelets pages, along with a template, provides the user interface to
the application.
• CDI managed beans are associated with each of the Facelets pages.
• A custom image map component on the front page allows you to select a book
to enter the store. Each area of the map is represented by a JavaServer Faces
managed bean. Text hyperlinks are also provided for accessibility.
• Action listeners are registered on the image map and the text hyperlinks. These
listeners retrieve the ID value for the selected book and store it in the session
map so it can be retrieved by the managed bean for the next page.
• The h:dataTable tag is used to render the topic catalog and shopping cart
contents dynamically.
• A custom converter is registered on the credit card field on the checkout page,
bookcashier.xhtml, which also uses an f:validateRegEx tag to
ensure that the input is correctly formatted.
Search WWH ::




Custom Search