How to Install the DukeBookStore Servlets

1. Download the zip file for the application (version 2.1) from JavaSoft (link: http://java.sun.com/docs/books/tutorial/servlets/overview/example.html)

2. Unzip the zip file into the D:\JSDK2.1\Webpages\Web-Inf\servlets directory (Note that this example needs to be placed in the default servlet directory because the servlets have been coded to run from the http://IPaddress:8080//servlet/... directory

3. After the unzip, you should see the following files. Note that there are two subdirectories -- Database and Cart

BookDetailServlet.java
BookStoreServlet.java
CashierServlet.java
CatalogServlet.java
ReceiptServlet.java
Database
    BookDBFrontEnd.java
    BookDetails.java
    BookStoreDB.java
Cart
    Cashier.java
    ShoppingCart.java
    ShoppingCartItem.java

4. Compile all the souce files (i.e., javac *.java)

5. Change the file D:\jsdk2.1\webpages\WEB-INF\mappings.properties to (the hightlighted ones are the new lines to add)

# $Id: mappings.properties,v 1.3 1999/04/05 21:20:02 duncan Exp $

# Map servlets to paths
# Properties beginning with a . are extension properties, all other
# properties are path properties

/snoop=snoop
/catalog=catalog
/bookdetail=bookdetails
/showcart=showcart
/cashier=cashier
/receipt=receipt
.snp=snoop
.jsp=jsp

6. Change the file D:\jsdk2.1\webpages\WEB-INF\servlets.properties to (the hightlighted ones are the new lines to add)

# $Id: servlets.properties,v 1.2 1999/04/02 02:04:22 duncan Exp $

# Define servlets here

# <servletname>.code=<servletclass>
# <servletname>.initparams=<name=value>,<name=value>

snoop.code=SnoopServlet
snoop.initparams=initarg1=foo,initarg2=bar
catalog.code=CatalogServlet
bookdetails.code=BookDetailServlet
showcart.code=ShowCartServlet
cashier.code=CashierServlet
receipt.code=ReceiptServlet

jsp.code=com.sun.jsp.runtime.JspServlet

7. Now you should be able to start running the application. Just type http://localhost:8080/servlet/CatalogServlet or http://localhost:8080/servlet/catalog The reason that both will work is because the second one has been mapped to the first one with the changes you made in steps 5 and 6. Now I have just save you hours of time :-) that I wasted :-( on this issue when I first looked at this app.