Programming for the WWW
Fall 2003

CIMS CS Department

Homework Assignment #3
Homework Due: Nov 10th

1) Make the TCPTaxComputer a threaded service that supports multiple client requests simultaneously. Limit it to only creating a maximum number of threads based a value passed into the application from the command line. This value should be a integer on the order on 10 to 20. It should REFUSE (or BLOCK and wait) any connections, if all the threads are currently busy. 

It should print a message to the console for every client request to connect that gets blocked/refused. It should print a message to the console every time a new client is accepted and when the client disconnects.

2) Create a Servlet that loads and saves a customer object to a file called "customerfile.txt" in the current working directory. You should be able to enter data into a web page and it gets saved to a file on the server. 

NEW! - You only need to save/read the data from that single file. For this project all customers will save/read from that file and overwrite the data each time. This file is just a simplification for this homework. You MAY if you wish, serialize out a java object such as a hashtable or list that contains all customers info and indexes them based on the customer ID (a unique field.) That would require being able to look a customer up by ID and adding a field to the UI - you DO NOT have to do this for this HW.

Use the code created to handle a customer.

Create a Servlet that returns a HTML form initially.

When a user pressed the SAVE button it does a POST and the servlet then gets the information from the POST parameters and saves this customer information to a file.

then the web server returns a new page that is:

It reads the saved file back in and then does a .toString() to get data and create a simple HTML page

See the files in the lecture set for ideas including:

      GVBooksOnlineWithDB.html    //use to cu and paste the form into your servlet if you wish
      GVBooksOnlineWithDB.pdf  //do NOT just copy this text as your assignment

Be sure to zip up all the servlet related files including the complete web application directory and its subdirectories and files. OR create a WAR file (better) and send that to your TAs.

 Example zip the MyWebModule and its subs.

 Copyright Poelman & Associates, Inc. (c) 2003 
For problems or questions regarding this web contact [ClassWebEmail].
Last updated: 11/01/03.