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.
[Reading]
Textbook Chapter 6, 7, 8,
and 9, especially Section 7.5.
[Login and Logout] (40pt)
Most bulletin boards allow all visitors to view the content of the
board, but only allow registered users to create new topics or post
replies. For this assignment, you are going to add this feature to the
bulletin board servlet you developed in Homework 1.
In particular, whenever a user tries to create a new topic or post a
reply, the servlet should first check whether the user is already
logged in. If not, the user should be redirected to a Login page, where
they must provide a valid username and corresponding password. 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:
The login procedure cannot
be
bypassed.
User authentication must
happen on the server side.
Once a user is
authenticated, a session is created so the user
won't be asked for username and password repeatedly. A user may also
choose to "logout", in which case the session should be terminated.
For session tracking, you must use Servlet Session Tracking API.
Username "cysun" with
password "abcd" must be an valid account.
Modify your bulletin board interface so that a user can create new
topics. For example, add a "New Topic" button or link as shown in
Figure 1(a), and when a user click on the button, the servlet displays
a web form, so the user can type in the subject and the content of the
new topic, as shown in Figure 1(b). Note that only users who have
logged in can access the web form, and if a user has not logged
in yet,
clicking on the New Topic button should bring him or her to the Login
page. Also note that you should create a similar interface for posting
replies.