Homework
1
CS320,
Fall 2005
Due: Thursday, October 6
Please upload your files using the online
turnin server.
The files should include all the source code, documentation, and an
HTML
file hw1.html,
which
contains a link to your servlet on the CS server. Note that file
uploading will be disabled automatically after 11:59PM
of the due date, so please turn in your work on time.
[Reading]
- Textbook Chapter 1, 3, 4, 5,
19
except 4.7.
[Online Bookmark Manager]
For this assignment, you are going to write a
servlet that implements
an online
bookmark manager, which sort
of like del.icio.us.
An online
bookmark manager manages bookmarks for a number of users. Each user has
their own home page, where they can add, delete, and edit bookmarks,
and organize the
bookmarks in some folders. In particular,
- (10pt) When the
servlet is requested
without any parameter, it simply displays the a welcome message.
- (30pt) When the servlet is
requested with a user
parameter, e.g.
http://cs.calstatela.edu:8080/cs320stu31/servlet/BookmarkManager?user=cysun,
it displays the home page of the specified user, which looks like the
following:
For this assignment,
you need to have at least two users (with cysun being one of them). If the
servlet is requested with an invalid user, simply displays the welcome
message again.
- (20pt) Each user has at least two folders, Public and Private. A user may choose to see
the bookmarks in a folder by clicking on the name of the folder. Note
that currently selected folder should not be "clickable".
- (10pt) When a user clicks Delete,
the corresponding bookmark will be deleted. We will leave bookmark
editing for next time.
- (30pt) When a user clicks the Add
New Bookmark button, the servlet displays the following page
which allows the user to add a new bookmark:
[NOTES]
- The easy way to start this
application (or any other web
application for that matter), is to separate the business logic
and the presentation
part of the
application, and start with business logic. In particular, the business
logic of this application consists of the following classes: User,
Folder,
and Bookmark, e.g. a user
owns a number of folders, and a folder contains a number of bookmarks.
Once the business logic is
completed, the presentation part, which is the servlet, is quite
straight-forward -- simply create a few User objects (together with the
folders and the bookmarks they own) as class variables of the servlet,
and display or update the bookmarks based on the HTTP requests.
- Since we have not covered
databases yet, the content of the bookmark manager may be lost after
the servlet is unloaded or reloaded.
That's ok for this assignment.
- Our subsequent homework
assignments will be built on top of this
assignment, so make sure your design, especially
the business logic part, is extensible.