Please upload your files using the online
turnin server.
The files should include all the source code, documentation, and an
HTML file midterm.html
which contains a link to your JSP page
on the CS server. Note that file uploading will be disabled
automatically after 1:20PM, and late turnin will not
be
accepted.
[Problem Description]
In this exam you are going to implement a web application that reads
movie box office data from a text file, and displays the
data in a table that supports paging. A sample box office data
file can be downloaded from here (the same
file is also available on the CS server under the /tmp
directory so you don't have to copy it there).
Note that the box office information about a movie consists of seven
fields: this week's box office ranking, last week's box office ranking,
title, weekend gross, cumulative gross, the number of weeks that the
movie has been released, and the number theaters in which the movie was
shown. Fields are separated by comma in the file.
Your application should consist of a JSP page BoxOffice.jsp
and a Java bean BoxOffice.java.
You may use more JSP pages or Java classes if necessary, but note that no
scripting elements or JavaScript is allowed in the JSP page(s).
[Implementation]
When BoxOffice.jsp
is requested without any parameters, it
displays the first 5 movies in a table as shown below:
When a user clicks Previous, Next, or one of the page numbers,
the corresponding movie listings should be displayed, for
example, the following table should be displayed when the user clicks
page 3:
A user should be able to change the number of movies displayed in
a page by passing a request parameter n
to BoxOffice.jsp. For
example, http://some.host/BoxOffice.jsp?n=10
should set the number of
movies displayed in one page to 10.
The number of pages should not be fixed. It should be
calculated based on the number of movies in the box office data file
and the number of movies to be displayed in one page.
The page number of the currently selected page should not be
"clickable". Similarly, the Previous
page link (or the Next page
link) should be removed if the first page (or the last page) is
selected.
[Grading Criteria]
Read data (15pt)
Basic paged display (50pt)
Change number of movies per page (10pt)
Enable/disable links (10pt)
Everything works correctly
on the CS server (15pt)
midterm.html
is missing
or
doesn't have the link to BoxOffice.jsp on the CS server (-5pt)
Please do not modify
your files on the CS server after the due time. Doing so will be
considered cheating.