Homework 2
CS320, Fall 2005

Due: Thursday, October 20

Please upload your files using the online turnin server. The files should include all the source code, documentation, and an HTML file hw2.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.

[Folders] (40pt)

Modify the servlet you developed in Homework 1 so that a bookmark folder has an additional attribute type. The type of a folder can be either public or private (don't confuse folder types with folder names, which may also be called Public or Private). The bookmarks in a public folder can be viewed by everybody, but the bookmarks in a private folder can only be viewed by the owner of the folder.

For this assignment, also add the feature to create new folders. For example, add a link (or button) to the user's home page which says "Create New Folder", and when the user clicks the link (or button), the servlet displays a simple form that looks like the following and lets the user to create a new folder:

Folder Name: Public Private

Note that all bookmark operations (add, delete, edit) should work for user-created folders.

[Login and Logout] (30pt)

As we discussed before, all public folders are viewable by everybody, but operations such as accessing private folders, adding, editting, or deleting bookmarks can only be performed by the owner of the bookmarks. In particular, if one of these operations is attempted, the servlet should first check whether the user is already logged in, and if so, check whether the user is the owner of the folder/bookmark. If either of these checks fails, the user should be redirected to a Login page, where they can login as the owner of the bookmarks.

It is completely up to you to decide whether to implement this feature with one servlet, two servlets, or some combination of servlets and HTML pages. However, whatever implemention you choose, it has to meet the following requirements: [Edit Bookmark] (30pt)

Implement the Edit Bookmark feature which we left out in the last assignment. Note that the interface for editting a bookmark is almost identical to the interface for adding a bookmark shown in Homework 1, except that when a user edits a bookmark, the form should be pre-filled with the current information of the bookmark. Also note that a user should be able to use the Edit Bookmark feature to move a bookmark from one folder to another by simply selecting a different folder.