Home arrow Java arrow Page 2 - Online Store Application
JAVA

Online Store Application


If you want to build an online store application using Java, look no further. This article begins with an overview of the application, and then discusses the applicatin development process. It is taken from chapter 14 of JavaServer Faces Programming by Budi Kurniawan (McGraw-Hill, 2003; ISBN 0072229837).

Author Info:
By: McGraw-Hill/Osborne
Rating: 5 stars5 stars5 stars5 stars5 stars / 54
March 16, 2005
TABLE OF CONTENTS:
  1. · Online Store Application
  2. · Understanding the Page Control Flow
  3. · Structuring the Database Tables
  4. · The DatabaseUtil Class
  5. · The MenuBean Class
  6. · The ShoppingItemBean Class
  7. · Registering the Beans in the Application Configuration File
  8. · Adding the ActionListener
  9. · Creating the JSP Pages
  10. · The search.jsp Page
  11. · The shoppingCart.jsp Page

print this article
SEARCH DEVARTICLES

Online Store Application - Understanding the Page Control Flow
(Page 2 of 11 )

The control flow of the BuyDirect application is straightforward, similar to shopping in an online store such as Amazon.com. Here, we will take a look at the design of each page in the application.

The Main Page

The main page of this application serves as a welcome page, as shown in Figure 14-3. Users can use the menu box on the left side of the page to search for a product or browse the products by category. In fact, the menu box is available from every page, enabling users to search and browse without needing to go back to the main page.

The Search Page

Users can search for a product by entering a keyword in the Search box and clicking the Go button. All of the products found are summarized on the search page, shown in Figure 14-4. Each product is listed with its name and price, as well as a Details link. The user clicks the Details link to view the product details and to purchase the product.

The Browse Page

The application allows users to browse products by category by clicking one of the links in the menu box. Currently, there are five categories for BuyDirect: Digital Camera, DVD Player, Camcorder, TV, and Analog. Like the search page, the browse page lists each productís name and price with a Details link, as shown in Figure 14-5. However, this page lists products from the same category, rather than those matching a certain search key.


Figure 14-3.  The main page of the BuyDirect application


Figure 14-4.  The search page of the BuyDirect application


Figure 14-5.  The browse page of the BuyDirect application 

The Product Details Page

Clicking the Details link in either the search or browse page displays the details of the selected product, including a description, as shown in Figure 14-6. Notice the Buy button at the bottom of the page. Users click this button to add the product to their shopping cart.

The Shopping Cart Page

All of the products selected by the user for purchase are stored in a shopping cart. Every time the user adds a product to the shopping cart, the contents of the shopping cart are displayed, as in Figure 14-7. Users click the Check Out button at the bottom of the page when they are finished shopping.

The Check Out Page

When users are satisfied with their selections, they can proceed to the check out page to have their purchases processed. As shown in Figure 14-8, this page contains five input fields: Contact Name, Delivery Address, Name on Credit Card, Credit Card Number, and Expiry Date. All of the input fields are mandatory. If the user fails to enter a value into any of the input fields, an error message appears. Clicking the Pay button processes the order.


Figure 14-6.  The product details page of the BuyDirect application 


Figure 14-7.  The shopping cart page of the BuyDirect application


Figure 14-8.  The check out page of the BuyDirect application


Figure 14-9.  The order page of the BuyDirect application

The Order Page

The last page, the order page, transfers the shopping order details from the shopping cart to the database, effectively emptying the shopping cart. It prints a thank you note, as shown in Figure 14-9.


Designing and Accessing the Database

This BuyDirect application uses a relational database to store data, such as the product information, product categories, and orders. First, we will look at the four tables in the relational database, and then we will cover how to access the database from your Java code.

NOTE


The code listing for buydirect includes a script file to generate the database tables and populate them with data. You should consult your database server documentation for information about how to run the script to create the tables.

This article is excerpted from JavaServer Faces Programming by Budi Kurniawan (McGraw-Hill, 2003; ISBN 0072229837). Check it out at your favorite bookstore today. Buy this book now.


blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials