table of contents
MSAJSP

Source Code Archive

More Servlets and JavaServer Pages


Chapter 6: A Sample Web Application: An Online Boat Shop

To view source code for other chapters in this book, mouse over the table of contents bar on the left.

Source Code from Chapter

Note: right-click or shift-click on the links to download the associated file.

  • web.xml. Deployment descriptor for the boats application.
  • index.jsp. Top-level page of the boats Web application. Uses the app-styles.css style sheet and the yacht.jpg image file.
  • images/. Various image files used in the boats application.
  • CounterTag.java. Custom tag that outputs a Web-app-specific hit count.
  • Count.java. Simple bean used by CounterTag.
  • count-taglib.tld. Tag library descriptor file that associates the CounterTag code with the base tag name of count.
  • yachts.jsp. First of the three second-level pages that describe specific varieties of boats. This one is on yachts. Uses the app-styles.css style sheet.
  • tankers.jsp. Second of the three second-level pages that describe specific varieties of boats. This one is on oil tankers. Uses the app-styles.css style sheet.
  • carriers.jsp. Last of the three second-level pages that describe specific varieties of boats. This one is on aircraft carriers. Uses the app-styles.css style sheet.
  • ShowItem.java. Servlet that looks up information on an item that is for sale. Uses the MVC architecture, storing the data in a SimpleItem object and using either ShowItem.jsp or
  • MissingItem.jsp for the presentation.
  • ShowItem.jsp. Page that uses jsp:useBean to access the SimpleItem object that was created by the ShowItem servlet. Uses that object to look up the item’s description, its cost, and the location of an image file that illustrates it (see images/).
  • MissingItem.jsp. Page used by the ShowItem servlet when the item number is missing.
  • ShipTable.java. A collection of SimpleItem objects that describe ships.
  • SimpleItem.java. Bean that describes an item that is for sale. Used by the ShowItem servlet to store the data that the JSP pages will later retrieve and display.
  • ShowPurchases.java. Page that shows a table of purchases. Illustrates simple session tracking. Uses sucker.jsp to display the result.
  • ItemList.java. Very simple pseudo shopping cart. Maintains a list of items and can format them in an HTML table. Used in the boats example to show that each Web app maintains its own set of sessions.
  • sucker.jsp. Page that displays all items being purchased by client in the current session.
  • boats.war. The entire boats application bundled in a WAR (Web ARchive) file.

More Information

Java

JSF (JavaServer Faces)

Servlets & JSP
Ajax, GWT, & JavaScript

Spring, Hibernate, & JPA

Struts