Homework 2
CS520, Spring 2012

Due: Friday, April 20

Please upload your files to CSNS. The files should include all the source code, documentation (optional), and an HTML file hw2.html, which contains a link to your application deployed on the CS3 server. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.


[Class Websites]  A class website, e.g. the CS520 class website, typically includes some general information about the class (e.g. course name, instructor's contact information, office hours, and so on), as well as a number of sections such as lecture notes and assignments. Note that please do not confuse sections of  a website with class sections, which are courses offered in a particular quarter.

In this assignment, you are going to implement a web application that allows users to create and manage class websites. Your implementation must use servlet, JSP, and the MVC architecture. The data can be stored in application scope, i.e. you do not need to use a database for this assignment. Note that no scripting elements are allowed in JSP pages, and no JavaScript is allowed either.

1. (20pt) The default page of the application lists the existing class websites. For example:

Class Websites

quarter Classs
Spring 2012 CS520 Section 1
Spring 2012 CS520 Section 2
Fall 2010 CS320 Section 1

The classes in the listing should be ordered first by quarter in descending order, then by course code and section number in ascending order. Clicking on a class should take the user to the website of that class.

2. (30pt)  A user may access a class website at the URL http://<host>/<application>/sites/<quarter>/<course>/<section>, e.g. http://localhost:8080/hw1/sites/spring2012/cs520/section1/. If the website already exists, the application should display its content. For example: 

Spring 2012, CS520 Section 1

Time and Location: TR 4:20pm - 6:00pm in E&T A210
Instructor: Chengyu Sun
Office Hours: MW 1-3pm and TR 2-4pm, in E&T A317
Lecture Notes [Add]
Assignments [Add]
[Add More Sections]

If a user tries to access a class website that does not exist, the application should display the following:

The class website does not exist. Do you want to create it? Yes No

Clicking on Yes should take the user to a page where the class website can be created (as described in the next exercise), and clicking on No should take the user to the application default page where the existing class websites are listed.

2. (20pt)  To create a class website, a user must provide the following information about the class:

Spring 2012, CS520 Section 1
Time and Location:
Instructor:
Office Hours:

Clicking the Create button should take the user to the created class website.

3. (20pt) A user may add more sections to a class website by clicking on Add More Sections. For example:

Spring 2012, CS520 Section 1
Section Name:

After a section is added, the user should be redirected back to the class website.

4. (30pt) A user may add items to each section. An item consists of a name and a hyperlink. Fo example:

Spring 2012, CS520 Section 1, Assignments
Item Name:
Item URL:

After an item is added, the user should be redirected back to the class website.