HW3: Servlets
due Thursday 3/5/2009, 11:59pm
100 points
You may work on this homework in groups of 2 or 3. If you do so, then you should put all of your names in the template so that your names all appear on each page of your hw3 assignment.
You are to create a folder called hw3 in side your class server space (on the popper.cs-i.brandeis.edu:8088 server) by visiting the URL
http://popper.cs-i.brandeis.edu:8088/tim/cs2aspr09/home/YOURUNETID/hw3/hw3a-init.servlet.except that you use your unetid instead of YOURUNETID. You will need to create the following files in this folder:
hw3a-init.servlet hw3a_init.css hw3b.servlet hw3c.html hw3c.servlet hw3d.cssThe requirements for this files will all be described in detail below.
hw3a - a template
You should write two fileshw3a-init.servlet hw3a_init.cssThe first should define a template of the form
(define (YourUNETID-hw3page Title Body) ... )as we have done in class, but your template should generate an HTML page that has the correct DOCSTYLE tag and it should also contain four divs with ids top,sidebar,content, and footer. The
Body parameter
should go in the div with id body, but the other three divs should contain info about hw3. For example,
- the "top" div should identify this as your hw3 page
- the sidebar div should contain links to each of your hw3 files (e.g. hw3a.html, hw3a.servlet) and should also contain links to their source code (e.g. hw3a.htmlV, hw3a.servletV). You can also add links to your other homeworks (on people.brandes.edu)
- the footer div should contain a copyright line identifying you as the copyright holder for this page
- the content div should contain the "Body" parameter and nothing else.
hw3b.servlet
This should be a servlet that generates a webpage which can only be seen from an IP address that begins with 129.64. The servlet should use the template you created in part a. If the IP address is correct it should also report on the users browser type, using[(.getHeader request "User-Agent")]and the page from which the user came to this page, using
[(.getHeader request "Referer")]For example, your browser is
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)and you got to this page from the page
#null
hw3c - an html form and a servlet that does calculations with input from the user
You should write two files for this problem:
hw3c.html hw3c.servletBoth the HTML and servlet files should use the template you created in part a above. The hw3c.html file should contain a form that ask the user form information including some numeric information (e.g. age). It should contain at least the following tags:
form input (with types text, password, radio, checkbox, submit, and reset) selectThe form should ask the user for a unetid and also a password.
The hw3c.servlet file should accept all input collected by the hw3c.html form. If the user does not supply the right password (hw3yeah!) it should generate a "bad password" page. Otherwise, it should send an email to the user from you and to you from the user, repeating the information sent from the html form (i.e. the servlet parameters). Then it should do some calcuations with the numeric data and generate a webpage contain all of the original data (the servlet parameters) in addtion to the computed values.
Finally your hw3 should have a purpose. For example, pre-registration for some event. Or conducting a survey (where the results get sent to you), or performing some useful or interesting calculations...
hw3d.css - a CSS page for a particular class of webpages
Finally, I want you to try writing some CSS for a page that already exists. Visit the following page:http://dennett.cs-i.brandeis.edu:8080/fm/loginreg/viewmajor.servlet?majorid=Communication+and+Media+Studies
At the bottom is a page that allows you to select a custom CSS page. Click on that link and then enter the URL fo your hw3d.css page, which should be something like:
http://popper.cs-i.brandeis.edu:8088/tim/cs2aspr09/home/YOURUNETID/hw3/hw3d.cssHere is a list of the relevant CSS selectors for this page, where indentation indicates that the indented tags are contained in the tag above...
div#headline top of the page
span.pagetitle title of the page
div#body main contents of the page
div#addcourse form to edit the "theme"
div#progname name of the theme
div#progdesc brief description of the theme
div#contributors box containing a list of the people who contributed to this theme
div#contributorlist the list of contributors themselves
div#courses box containing the courses in the theme
div#courselist div containing the courses
span.count number of people choosing this course
span.coursenum course number (e.g. SOC 146A)
span.title title of the course (e.g. Mass Communication Theory)
div#footer footer containing a menu of links to servlets on the site (e.g. login/logout, ...)
