Home | Travaux STAF | STAF2x - Report for exercise 1 (Java servlets) STAF-E


"Quiz with Java servlet"


The Scenario
Technical details-problems
References - Bibliography

This time the conception was really easy... I had to take an old exercise and redo it with Java. So, I decided to take the quiz I have done for exercise 2 of STAF14 with PHP. The theme was "Transition period of Euro". Why this exercise? But of course, because it was a server-side application. So, the philosophy was pretty close or at least that's what I thought...

I was quite releaved that I didn't have to think about the subject of this quiz and at the same time, I was excited as there was already a challenge (I always need this in order to start doing something :) The old exercise had an innovative characteristic, questions one by one in successive pages and immediate feedback after each answer. Doing it again, this time with a Java servlet, seemed very interesting as I found really easy to do a classic quiz with a Java servlet.

So, my Java servlet has the same "look" with the old exercise and maybe someone won't even be able to distinguish which is which, but I definately can, because I had to get into the java servlets documentation and more precise to study "session tracking".

I borrowed the code of an example for a Shopping Cart and I was really excited to see how session tracking is being done with "cookies", something that I have watched several times in the e-commerce but I didn't know how this is being done...


The scenario

Introduction page:

At the beginning, the user faces a "welcome" page and starts a session by giving his/hers name and by accepting a "cookie".

Question mode:

Each question is being presented the same way with the old exercise, one by one in a page and the user has to choose from 3 radio buttons the correct answer and verify his answer by submitting it.

Feedback mode:

The verification of each asnwer is being done immediately by reminding the question and the possible answers plus a feedback message. Only that the possible answers this time have an icon in front, either a green "tick" before the correct answer, either a red "cross" before the wrong answer of the user (if there is one).


After answering to all of the 10 questions of the quiz, the user can watch his score and a feedback concerning his knowledge on the subject. There are of course the links to go and take a look to improve his knowledge or decide to redo the quiz ...


Technical details - problems
Doing a simple quiz with all the questions in one page was quite easy with a servlet so, by just watching an example I was able to do my own test quiz immediately after Daniel's presentation. The problem started when I decided to do the successive pages that meant session tracking which meant going over the documentation... Having not so much free time like last year, I had to be quick and efficient :)

I have to admit that the usefulness of both "doGet" and "doPost" in the same servlet is not so clear to me still. But on the other side, I started to have the feeling of a servlet and understand how it works (at least roughly :) after finishing this exercise.

The things that deserve to be mentioned specificaly:


References - Bibliography - Sites


©Vivian Synteta
Last modified 23/01/2000
Back to Travaux page