Midterm 1

October 16, 2010

This is an open-book, open-note, open-computer exam. 3 hours are allocated for this exam. 

You are to create a CS320 Quote Generator that displays random quotations to visitors.  Your application will consist of two (2) required servlets and one (1) optional servlet.

All Servlets should contain a header that reads, "CS320 Midterm - Quotation Generator"

QuotationServlet

QuotationServlet will randomly display a quotation and its author when a User visits the page.  This page should contain a button (not a hyperlink) that causes a new quotation to be displayed when clicked.  Note, you should not use any Javascript to accomplish this.

QuotationAdminServlet

The QuotationAdminServlet will serve three purposes:
Display ALL quotations currently present on the site in tabular form
Allow an Administrator to remove quotations from the site
Allow an Administrator to add quotations to the site

            All quotations should be displayed in a table with 3 columns. The first column will contain the actual quotation. The second will contain the author, and the third will contain a ‘remove’ link that, when clicked, will remove the quotation from the site.

            QuotationAdminServlet should display a form below the table of quotations.  This form will consist of two text fields labeled Quotation and Author, and a submit button.  When an Administrator attempts to add a new quotation to the site, QuotationAdminServlet should first validate the Admin’s input.  If any errors are present the quotation should not be added and error messages describing the problem(s) should be displayed.

A quotation is valid if and only if both Quotation and Author are not empty. 

StatisticsServlet (Extra Credit)

The StatisticsServlet should display all quotations in a table with 3 columns.  The first column will contain the quotation. The second column will contain the author. The third column will contain the number of times the quotation has been served to visitors of the site.

Grading

QuotationServlet

  • (10pts) Display a random quote
  • (10pts) Button to display a different quote

QuotationAdminServlet

  • (10pts) Display ALL quotations in a table with ‘remove’ link
  • (10pts) Allow an administrator to remove quotations by clicking the ‘remove’ link
  • (10pts) Allow an administrator to add new quotations

StatisticsServlet

  • (10pts) Display a table with every quotation, author, and frequency served.

CSNS Submission

  • (-5pts) Failure to submit source files (.java)
  • (-5pts) Failure to submit compiled files (.class)
  • (-5pts) Failure to submit web.xml
  • (-5pts) Failure to submit Assignments.html
  • Be sure to upload any additional files that you may have used in your assignment.

CS3 Demo

  • (-10pts) No CS3 Demo

 

TOTAL: 50pts

Downloads

Syllabus pdf

Examples zip

Slides

Introduction ppt

Servlets ppt

Requests ppt

Response ppt