Previous | Next | Trail Map | Servlets | Overview of Servlets

The Example Servlets

The remaining lessons in this trail show you how to write HTTP servlets. Some knowledge of the HTTP protocol is assumed; to learn more about the HTTP protocol, you could look at the RFC for HTTP/1.1.

The lessons use an example called Duke's Bookstore, a simple on-line bookstore that allows a customer to perform various functions. Each function is provided by a servlet:
 
FunctionServlet
Browse the books offered for sale CatalogServlet
Buy a book by placing it in a "shopping cart" CatalogServlet
Get more information on a specific book BookDetailServlet
Manage the Bookstore Database BookDBServlet
See the books that have been selected for purchase ShowCartServlet
Remove one or more books from the shopping cart ShowCartServlet
Buy the books in the shopping cart CashierServlet
Receive a Thank-You for the purchase ReceiptServlet

The lessons use the servlets to illustrate various tasks. For example, the BookDetailServlet is used to show you how to handle HTTP GET requests, the BookDBServlet is used to show you how to initialize a servlet, and the CatalogServlet is used to show you session tracking.

Several source files comprise the Duke's Bookstoreexample. For your convenience, we include a downloadable zip archive that contains all of the source files necessary to build and run the example.

Download the zip archive

To run the example, you will need to start servletrunner or a web server, and call the servlet from a browser


Previous | Next | Trail Map | Servlets | Overview of Servlets