Homework 5
CS320,
Spring 2006
Due: Wednesday, May 31
Please upload your files using CSNS.
The files should include all the source code, documentation, and an
HTML
file hw5.html,
which
contains a link to your JSP page 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]
[Problem Description]
For this assignment, add a registration page to
the blog application you developed in Homework
4
so a user can create an new account. Also implement a custom tag
<logout> so we can get rid of the last bit of scripting
element
from the application.
Again, all features described in previous assignments must work;
otherwise there will be a credit penalty of up to 30pt.
[Registration Page] (50pt)
In the registration page, ask the user to fill out a form as shown in
the
following example:
Your application should
properly handle the following errors:
- Required fields are empty.
- Username is shorter than 4
characters.
- Username conflicts with an
existing username.
- Password is shorter than 4
characters.
- Password and re-typed
password do not match.
For each type of
errors, output an error message and ask
the user to re-enter the data. Note that validation of the input data
should be implemented on the server side, i.e. not in JavaScript.
Optional fields can be empty,
which should not be treated as an error. However, if a user do provide
the optional information, you must store it in the database.
Once a
user is registered, they may start blogging in their own blog or making
comments in existing blogs.
[Logout Tag] (20pt)
Implement a <logout> tag so that instead of using
scriptlets as
described in Homework
3, your logout code
should look somewhat like the following:
<c:if test="${!
empty param.logout}">
<bb:logout />
<c:redirect url="Home.jsp"
/>
</c:if>
[Extra Credit Work]
For extra credit, modify your application so that it supports two types
of users: regular and admin. Once an admin user is logged in, he or she
can perform several operations that are not available to regular users:
- (20pt) Edit any
post. The system should automatically append
"Edited by ${admin} at ${time}." at the end of the edited post, where
${admin} is the username of the admin user, and ${time} is the time
when the post was edited.
- (20pt) Edit any
comment, and similar to editing posts, the system should automatically
append
"Edited by ${admin} at ${time}." at the end of the edited comment.
- (20pt) Disable/enable any regular
user account.
- (20pt) Reset any regular
user account password to a six-digit
random number
- (30pt) Keep a log
of the admin operations in the database, and create a JSP page so the
admin users can view this log.
For example, the database table for the log may consist of the
following fields:
- admin_id - id of
the admin
user
- target_id - id of
the post, comment, or user
- operation -
operation performed, such as 'edit post'
or 'disable account' etc.
- ts - the timestamp
when the operation is performed
- (Up to 20pt) Good user interface for the admin features.
Good interface does not have to be pretty, but it should be intuitive,
and makes it easy to perform the admin operations.
The due date for the extra credit work is Saturday, June 3, and you
may
turn it in as Homework 6. A hw6.html
must be included, which contains a link to your JSP page on the CS
server, the information of an admin account I can use to test your
application, and a list of extra credit feature(s) you have
implemented.