MIDTERM
CS320, Spring 2005


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 7:45PM, and late turnin will not be accepted.


[Problem Description]

In this exam you are going to implement a web application that helps a user create an online survey. A survey consists of a number of questions, and for simplicity, we assume that
Your application should consist of a JSP page SurveyBuilder.jsp and a Java bean SurveyBuilder.java. You may use more JSP pages or Java classes if necessary, but note that no scripting elements are allowed in the JSP pages.

[Implementation]

When SurveyBuilder.jsp is requested without any parameters, it displays a text field asking for the name of the survey, as shown below:

Please enter the name of the survey to be created:

After the user enters the survey name and clicks the Next button, SurveyBuilder.jsp displays a form that asks for the first question of the survey, for example:

Question:
Answer #1:
Answer #2:
Answer #3:
Answer #4:

The user enters the question and its answers, then clicks the Next button if there are more questions to be entered. Note that some questions may have less than four answers, and your code should handle them properly. After the user clicks the Next button, the JSP page displays the same form again for the next question. This process is repeated until the user clicks the Finish button, in which case the JSP page displays the generated survey. A sample of a generated survey is shown below (the first line is the name of the survey):

Linux on Desktop Survey
  1. Which distribution do you use?
    • Red Hat
    • SuSE
    • Debian
    • Other
  2. Which window environment do you use?
    • KDE
    • GNOME
    • Other
  3. Which web browser do you use?
    • Firefox/Mozilla
    • Konqueror
    • Opera
    • Other
  4. Which email client do you use?
    • Thunderbird
    • Kmail
    • Other

Note that the radio buttons in the generated survey must have proper group names and values. For example, in the sample survey above, the four radio buttons for Question 1 have the group name "q1" and values "1", "2", "3" and "4", and the three radio buttons for Question 2 have the group name "q2" and values "1", "2", and "3",  and so on.

SurveyBuilder.jsp uses a session scope bean of SurveyBuilder class. The implementation of the bean, SurveyBuilder.java, is completely up to you, as long as the bean is sufficient to support the JSP page. Note that since the bean is associated with the session scope, if the session is terminated, the data stored in the bean will be lost - that's all right for this application.

[Grading Criteria]