CIS 5930-04
Spring 2001
Homework #4
A Web-based User Interface using Servlets
Rewrite the client-server application you developed in the previous
homework. Instead of using an applet front end to an RMI-based file
server, the user interface should consist of a series of HTML pages
with suitable forms, generated and handled by one or more servlets. A
data file on the the Web server will be manipulated by the servlets.
The application should be deployed under a Tomcat server running on
the port allocated for you on
sirah, merlot, cabernet
or pinot,
in CSIT. The lectures give details on how to install and run
the Tomcat server. Port allocations will appear on the course
announcements page.
Submission of your Homework
Your submission should consist of files including
-
A short description of your application,
preferably in Microsoft Word,
HTML, or plain text format,
which should be copied to the directory called
/home/project/it1spring01/homework4/uid
on sirah, where
uid is your login ID.
For this homework, the .html and .java
source files you develop should be left in the installation directory for
your Tomcat server, which should be in the home directory of your
sirah account.
Grading
For this assignment, there will be a total of 20 points.
Grading criteria are similar to
Assignment 1.
Some points will be assigned on the basis of apparent effort and
uniqueness.
Resources and Tips
File Access from servlets
In general file I/O from servlet code is identical to Java file I/O
from any other code. One thing to be careful about is using relative
vs. absolute path names. If you use a relative path name for a file
(e.g. "myfile") the accessed file will be
in the current working directory associated with the Tomcat server.
This is whatever directory you happened to be in when you started
the server. This is unlikely to be what you really want, so
instead you should open files using absolute path names
(e.g. "/home/users/dbc/jakarta-tomcat/webapps/dbc/myfile").
Of course it is not good practice to "hard-code" absolute path names
like this into your programs. Instead, use the method
getRealPath() from ServletContext to
convert a "uri" in the current context to an absolute path name, as
in:
ServletContext c = getServletContext() ;
... new FileReader(c.getRealPath("/myfile")) ...
This opens a file called myfile in the root document
directory of the current context (i.e. the directory holding top-level
HTML files for the context).
Deploying Tomcat
Download Tomcat from the Jakarta
Project home page. For installation instructions, see the
lectures, starting here.
Servlet examples
See the examples for the servlets lecture set,
here.
Please send questions to Bryan Carpenter at dbc@csit.fsu.edu.