Lab 1. Beans, EL, and JSTL
CS320, Winter 2012


Due: Monday, February 6, 10:30PM

Please upload your files for Part II to CSNS. The files should include all the source code, documentation (optional), and an HTML file lab1.html which contains a link to your application deployed on the CS3 server. Note that file uploading will be disabled at 10:30PM, and no submission will be accepted after that.

[Part I] (10pt) Please complete Part I on CSNS.

[Part II] (30pt) For this exercise you are going to implement an online test application using JSP. The application reads a number of multiple-choice questions from a text file, displays the questions one at a time, and collects the answers from a user. Once the user completes all the questions, the application compares the user's solution to the standard solution and displays a score.

A sample file for a test can be downloaded here. The format of the file is as follows:

A copy of the sample file DrivingTest.txt has been placed on CS3 under the folder /tmp. When you deploy your application on CS3 you may use the path /tmp/DrivingTest.txt to access the file.

1. Implement a TestEntry class which consists of at least the following methods:

2. Implement a class TestBean which consists of at least the following:

3. Create a JSP page Test.jsp that uses a session scope TestBean. Test.jsp displays the test entries one at a time, and displays the score when the user completes the test, as shown in the sample display below. Note that you may not use scripting elements in the JSP.

When the page is requested for the first time:
When the page is displaying the last entry:
After the user clicks FINISH:
You may drive off of the paved roadway to pass another vehicle:
1. If the shoulder is wide enough to accommodate your vehicle
2. If the vehicle ahead of you is turning left.
3. Under no circumstances
To avoid last minute moves, you should be looking down the road to where your vehicle will be in about ______________.
1. 5 to 10 seconds
2. 10 to 15 seconds
3. 15 to 20 seconds

Your score is: 80

Hints:

[Post-Lab Activities]