CMSC484 Java Server Technologies
Fall 2004
Project 1
On-Line Store Servlet Project
Due Date: October 20, 2004
Project Description
In this project, you will be implementing a simple on-line store
using Java servlets. The sample page given below illustrates an on-line
book store, but you can implement any kind of store (within the bounds
of good taste, of course) that you like.
Project Requirements
Your project should have the following elements:
- Welcome Servlet
This servlet welcomes the customer to your web site and provides a
form to search for items. The action of the search form should
be the Search Servlet described below. The Welcome Servlet should
use a cookie to recognize a returning customer and customize the
welcome page accordingly.
Here is a simple example of the type
of the page to be generated by the Welcome Servlet.
- Search Servlet
This servlet searches the store database for items and returns the
results. Each item returned should be in the form of a hyperlink
which allows the user to find out more details about the item.
This hyperlink invokes the Display Item Servlet described below.
The returned page should again have the basic search form as a
convenience to the customer.
- Display Item Servlet
This servlet displays details about a particular item and displays
buttons to allow the customer to add the item to a shopping cart and
to view the shopping cart. The actions of these buttons should be
to invoke the Add To Cart Servlet and View Cart Servlet.
- Add To Cart Servlet
This servlet adds a item to a shopping cart and returns a page
detailing the currents contents of the shopping cart. A session
object should be created and used to keep track of the customer's
shopping cart. The returned page should also have a "Proceed To
Checkout" button whose action is to invoke the Checkout Servlet.
- View Cart Servlet
This servlet returns a page detailing the currents contents of the
shopping cart. The returned page should also have a "Proceed To
Checkout" button.
- Checkout Servlet
This servlet returns a page providing the details of the items
being ordered and the total amount due. It also has a form asking
for some customer information (minimally, the customer's name) and
a "Confirm" button whose action is to invoke the Confirm
Servlet described below.
- Confirm Servlet
This servlet returns an order confirmation page to the user. It
also sets a cookie with the user's name for use by the Welcome
Servlet in a later transaction.
- Product Database
You may use any type of database you like for your store products,
but you must have at least ten items available for sale.
It is always good practice to program to an interface, so you
should have a Database interface and then one or more classes that
implement the interface. One class could parse a text file and
store the items in a hash table. Another class could used a real
database (Oracle, Access, mySQL) accessed using JDBC.
For example, here is an interface for an item database:
ItemDB.java
And here is a class which implements ItemDB by parsing a text file
where the fields are tab-separated and storing the results in a
HashMap:
FileItemDB.java
And here is a sample text file database:
books.txt
You must submit your project as a web application, (that is, a .war
file) which can be dropped into Tomcat and run.
Project Grading
Your project will be graded according to the following criteria:
- Program Correctness - 70%
- The program performs all of its required functions properly.
- The program has no bugs.
- The program handles appropriate error conditions properly.
- The program operates with reasonable efficiency.
- Proper use of servlet conventions and APIs - 10%
- Nifty features you added that really impressed me - 10%
- Coding Style - 10%
- Good, professional documentation.
- Good readability and understandability.
- Proper use of indentation to highlight function flow control.
- Proper use of blank lines to highlight distinct sections of a method.
As in all your work, NO COPYING OR PLAGIARISM. If such is
detected, no credit for the project will be given and appropriate
actions for academic dishonesty will be taken.
Project Submission
You must submit the following:
- All source files, including all .java and .html files, preferably
in a zip or jar file.
- The .war file for your web application.
Submit all of the above using the submit program. To submit, you type
submit cs484 project1 <filenamelist>
where filenamelist is a list of one or more files. You can submit a
file as often as you like; the latest file submitted overwrites any
previous submissions. To list the names of the files you have submitted,
type
submitls cs484 project1
To remove a previously submitted file, type
submitrm cs484 project1 <filename>
Project Due Date
This project is due October 20, 2004. You have a one week, automatic,
no-need-for-a-lame-excuse grace period.
No project will be accepted after October 27, 2004.
NO EXCEPTIONS! NO EXCUSES!