| Duke's Bookstore Sample Application |
Duke's Bookstore Sample Application
This document describes how to utilize the Duke's Bookstore sample application in conjunction with the Application Server.This sample application document contains the following sections:
- Overview
- Compiling and Assembling the Application
- Deploying the Sample Application
Overview
The Duke's Bookstore sample application illustrates the tasks involved in programming using web Technologies. Dukesbank application allows users to retrieve available books from a database table, displays details of the book, add and remove books to a shopping cart and check out the books. The Duke's Bookstore example showcases different web technologies in the following application:
- BookStore1: This sample implements the Duke's Bookstore sample using servlets. The database connection is made from servlets, monitors servlet lifecycle events, and showcases the use of filters.
Directory Structure
The bookstore sample and its associated files are kept under the samples/webapps/bookstore directory
File
Description
bookstore1
All files relating to bookstore1 sample.
docs
docs for bookstore1.
common
common files, like sql.
The bookstore sample has build.xml and deployment descriptors under the src directory. (e.g. bookstore1/src).
Compiling and Assembling the Application
This section contains instructions to build and assemble the Duke's Bookstore sample application.To compile, assemble and deploy the application, see the Sample Application Build Facility document for details on using asant facility to quickly perform these tasks.
- To rebuild the entire application from scratch, do the following:
- To clean up the sample application project area, do the following:
NOTE: You must start the Database.
Please ensure that the database is started, (see How to start Database) before proceeding with deploying and running the sample application.
Deploying the Sample Application
In this section, you will learn how to deploy the Duke's Bookstore sample application.To deploy the application, do the following:
- Start your database server (PointBase), if not already started.
- Go to the bookstore/bookstore1/src directory
- Execute the command asant deploy. This deploys the bookstore application. This also handles the creation of the jdbc datasource for pointbase database.
Note You must run asant undeploy before redeploying this sample. This will ensure that all modules are undeployed and the resources are disabled.
To undeploy the application, do the following:
- Go to the bookstore/bookstore1/src directory
- Execute the command asant undeploy . This also deletes the jdbc datasource for pointbase database.
Running the Sample Application
In order to run the sample application, you must first do the following:
You are now ready to run the sample application by doing the following.
- Start your database server (PointBase).
- Compile, Assemble and Deploy the application as described in the previous sections Compiling and Assembling the Application, and Deploying the Sample Application.
The bookstore sample has build.xml and deployment descriptors under src directory. (e.g. bookstore1/src)
- bookstore1: On your browser go to the url : http://<host>:<port>/bookstore1/enter
The following images are from running the bookstore1 sample.
Figure 1 Duke's Bookstore: "Start Shopping" link
Figure 2 Duke's Bookstore: Shopping Cart
Figure 3 Duke's Bookstore: Cashier
Generating javadocs
To better understand sample application source code, you may refer to the related javadocs.To generate javadocs, run one of the following commands:
After javadocs are generated, you may access them at samples/webapps/bookstore/bookstore1/javadocs/index.html.
- If you encounter problems when running the application, review the log files at <install-dir>/domains/<domain_name>/logs/server.log to learn what exactly went wrong.
- Check to see if the database is running.
- To reset your database, run the command asant sql.
- To redeploy the sample, please undeploy the sample first. Use the commands asant undeploy, asant clean and then asant all.
Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
Last
Updated February 10, 2004