Homework #4 Spring 2007
Due: Monday April 9
Purpose:
- Understand Servlets
- Create your own web application
- Use cookies or sessions to save state
- Interact with a database or use image files
Preparation:
- Read chapter 9
- Run sample programs
Lesson:
For this assignment you will create a new web application that makes
use of servlets and either cookies or a session to track state.
Two example applications are shown below. The first application
is a mentoring system.
This screen (CSM_AddMentor.html) is used to add mentors to the database:

This screen (CSM_MentorNet.html) is used to query the database:

This screen (returned by the servlet) shows the results:

Cookies are used to save partial selections in case users need to
change some of their choices:

Sample application #2 uses images rather than a database. The
first screen prompts the user to select a destination:

Pictures are displayed based on the selection:

Cookies are used to avoid repeating destinations that have been
visited:

Requirements for your program:
- Must be in a new web application (don't just add a servlet to
advjhtp1)
- Must include at least two methods (e.g., doGet and doPost, or
doGet/doPost in two different servlets)
- Must use either a database or some image files.
- Must make use of cookies or session tracking to preserve state -
don't just create the cookies, do something with them (as in the sample
programs, the user only needs to enter certain information because
other information is retained)
- Team projects are OK, but must include at least 3 methods
(requires at least two servlets)
Submission:
Create a zip file of your web application. Be sure that it
includes web.xml and an sql file if your application uses a database.