This chapter describes the design, file components, and functionality of the online bookstore sample application.
Design Overview
Presentation Flow
Directory Structure
Servlets
EJB Functionality
HTML
JSPs
servlets
EJBs (stateful session bean, stateless session bean, and entity bean)
database access through helper classes and JDBC APIs
transaction processing, both local and global
integration with an LDAP server
From a web browser, the user navigates the Internet to reach the first page of the application, index.html.
From index.html, users can follow two main branches: customers can click the Store Entrance image to display BookStore.jsp, and application administrators can click the Manager's Office image to invoke AdminServlet.
As a typical user, a customer clicks the Store Entrance image. The application then displays the main customer page, BookStore.jsp.
From the BookStore.jsp page, a customer can browse books by subject, search books by keyword, or add books to a shopping cart. Any of these tasks can be performed as an anonymous user. However, before placing an order or checking previous orders, a customer must sign in.
Clicking the Sign In link invokes the Login servlet. This servlet causes the right side of the page to display the Customer Sign In form, a JSP named LoginForm.jsp.
From the Customer Sign In form, customers can take either of two actions. Customers who previously registered can enter their email address and password, whereas new customers must click the Register here link.
Clicking Register here invokes the Register servlet. This servlet causes the right side of the page to display the Registration form, a JSP named RegistrationForm.jsp.
Regardless of whether a user is registered, the user can perform different types of searches from the left side of the page, using either the Quick Search table or the Explore table. These page elements invoke the SearchServlet.
When a results page appears, users can click a book title hyperlink. Clicking a book title invokes the BookDetail servlet, which in turn displays a JSP of item details.
If the book is of interest, the user presses a button to add the item to the shopping cart. This action invokes the CartServlet, which in turn displays a JSP of selected books. The displayed prices are calculated with the help of ShoppingCartBean.
When the user is ready to buy the items in the shopping cart, the user presses the Place Order button. This action invokes the PlaceOrder servlet. This servlet uses the CashierBean to calculate the charges, then displays the charges using the ShowOrder JSP.
The user can continue to navigate the application, searching for more books or checking previous orders, for example.
Eventually, the user clicks the Logout hyperlink to invoke the Logout servlet.