The purpose of this assignment is to help you learn or review Web programming in Python, Java, or PHP.
Make sure you study the COS 333 "Policies" Web page before doing this assignment or any of the course's assignments.
You must work with one partner on this assignment. If the count of students working on the assignment is an odd number, then exactly one team may consist of three students; we will ask that team to implement some features in addition to those that are described in this document.
Only one of the partners should submit files. Your
readme file and your source code files should contain your name and your partner's name.
This assignment asks you to create a Web application. You must do so using Python CGI programming, Java CGI programming, or PHP, without the assistance of any Web application development frameworks (Django, Struts, etc.).
As with Assignments 2 and 3, assume that you're working for Princeton's Registrar's Office. You're given a database containing data about classes and courses offered during an upcoming Princeton semester. Your task is to create an application that allows Princeton students and other interested parties to query the database.
Your application should be a Web application. It should be expressed as:
The database is identical to the one from Assignments 2 and 3. Please refer to the specification of Assignment 2 for a decription.
Recall that all COS 333 students will use the one-and-only-one cos333 database. The cos333 database is not read-only. So, for the sake of other students, please be careful not to change the database.
Your application should have an
index.html file that causes the browser to render an index page. That page should contain a link to your "primary" application page.
Your primary page should contain a form. The form should allow the user to specify a
title. Of course the form also should contain a button that the user can click to submit the form.
Your program should discard white space characters at the leading and trailing edges of the data that the user enters into the form, and should handle the '%' and '_' wildcard characters, just as described in the Assignment 2 specification.
In addition to the form, your primary page should display the results of the query that is triggered by submission of the form. Specifically, the primary page should display the
title of each class that matches the specified criteria, or of all classes if the user specifies no criteria. The lines should be sorted; the primary sort should be by
dept, the secondary sort should be by
coursenum, and tertiary sort should be by
classid. The lines should be well formatted.
Along with results of the query, your primary page also should display, within its form, the query criteria that user entered to generate those results. For example, if the user entered "cos" in the
dept input of the form, entered "qr" in the
area input of the form, and submitted the form, then the resulting page should display "cos" in the
dept input of the form and "qr" in the
area input of the form -- along with the data for all classes that match those query criteria.
Your primary page should allow the user to click on the data for any of the classes that it displays, thereby allowing the user to learn more about that class. When the user clicks on the data for a particular class, your application should display a "secondary" page containing the selected class's
profname(s). The data should be well formatted.
The secondary page should contain a link (or button, if you prefer) back to the primary page, thus allowing the user easily to perform another class search. In the resulting primary page, the form should show the same data that the user entered most recently. The resulting primary page also should show the class data that resulted from the submission of that form. Hint: Your application must be "stateful" to accomplish that.
Certainly it's possible to design a better interface than the one just described. If you would like to do so, then discuss your design with the course's instructors before you implement it. No surprises please!
Submit your source code files on
penguins using these commands:
/u/cos333/bin/i686/submit 4 index.html /u/cos333/bin/i686/submit 4 theFilesComprisingYourApp
If you use Java, then submit both your
.java files and the
.class files generated from them. Your grader should be able to copy your files to some appropriate Web server directory, browse to your index.html page, click on its link, and execute your application. Your grader should not need to build your application.
As noted above in the "Rules" section, either you or your partner, but not both, should submit files. You can submit multiple times; we'll grade the latest files that you submit.
readme file should contain:
readme file should be a plain text file. Don't create your
readme file using Microsoft Word or any other word processor.
Please follow the rules on what to submit. It will be a big help to us and to your grade if you get the filenames right and submit exactly what's asked for. Thanks.
To grade your application we will run it to execute multiple queries. Your grade will be based upon the correctness of the data that it displays and the usability of its interface.
It won't be possible for us to inspect your code manually. Instead we will grade your code based upon its behavior only. The good news: the code that you submit need not be well-styled -- although we strongly suggest that you use good style for your sake. The bad news: if your code fails the tests on some particular functionality, then we won't be able to inspect your code manually to try to assign partial credit for that functionality. So please make sure your code behaves properly.
This assignment was written by Robert M. Dondero, Ph.D.