Homework 4
CS320, Spring 2006


Due: Saturday, May 27

Please upload your files using CSNS. The files should include all the source code, documentation, and an HTML file hw4.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, modify the blog application you developed in Homework 3 so that it stores all the information about blogs, posts, comments, and users in a database. Again, all features described in previous assignments must work; otherwise there will be a credit penalty of up to 40pt.
[Database] (35pt)

Design database tables to store information about blogs, posts, comments, and users. Since this is not a database class, you do not have to worry about normal forms and such. However, you have to make sure that your database design is functional and correct, for example, a username attribute should have a UNIQUE constraint to ensure that no one can register a user name which is identical to an existing user name. For this part of the assignment, you need to turn in a hw4.sql file which include the statements to create all the tables in the database, and the statements to populate the tables so that each table has at least two records.

[JSP] (40pt)

Once the database is set up, modify your blog application so that it uses the database to store all the information. Note that you do not have to create a user registration page - we will leave that for the next assignment.

[Discussion] (5pt)

We have discussed two ways to access a database: a) using JDBC in Java bean code, and b) using SQL tag library in JSP pages. In your hw4.html, briefly discuss the pros and cons of these two approaches, and which approach you used in your application for what functionality.