Lab #4 - Creating Pages with Database Content

CS 183 - Hypermedia and the Web

The goal of this laboratory assignment is to store and receive information in a database from within a servlet. Many Web applications involve interactions with one or more databases, and hence the techniques learned in this lab assignment apply broadly.

Since the assignment involves interacting with a database, you will need to configure your account so you can access the MySQL database, found in the course locker. Instructions for setting up your account can be found here. As with previous servlet exercises, you should execute MySQL on an individual workstation, and not on unix.ic. To make your code work, you will need to have the Tomcat server, the MySQL server, and a Web browser (Netscape) all running at the same time. We recommend that you start MySQL first, then Tomcat, and then Netscape.

The problem:

  1. Create a Web application that allows the user to enter a person's name (first and last), and then stores that name persistently, in a database. The Web application must provide a listing of all of the names, in alphabetical order, by last name. This listing of names must be provided in an HTML table.

To perform the assignment, you will need to save the name information in the MySQL database. The HTML table will be constructed from information retrieved via an SQL query sent to the database, and the alphabetization can easily be accomplished using SQL.

Last modified: 5/12/2003