jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Online Quiz Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Online Quiz Application" Watch "Online Quiz Application" New topic
Author

Online Quiz Application

Ankitt Gupta
Ranch Hand

Joined: Feb 19, 2009
Posts: 101
Develop a JAVA servlet/ JSP application:
Have a set of at least 10 questions and their corresponding answers. Please do not use a database to store these. You may use a file or use static variables in your code for the Q&A. Every time the application is accessed it would show a question and a multiple choice of 4 answers. It would wait for the user input (through radio buttons and 'submit' button).

If user input is correct, it displays "Congratulations. Your answer is correct!"

If user input is incorrect, it displays "Sorry. The correct answer is xxx"

After every Q&A, it would ask the user if he wants to answer another question. If 'yes', then it displays another question from the pool. If 'no', then it says "Bye. Please Visit Later"

NOTE:
1. The questions that are displayed should be randomly selected so that every time the application is loaded, the user is presented with a different question
2. In any given Q&A session, the system should not display the same question twice


I have develop the following 10 JSP's for each question.


JSP1.jsp



S_JSP1.jsp


I want to ask how to achieve the following...
NOTE:
1. The questions that are displayed should be randomly selected so that every time the application is loaded, the user is presented with a different question
2. In any given Q&A session, the system should not display the same question twice

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
That is hardly a general solution is it? I suspect your instructor would not be happy with it.

It is time to back off and separate the parts of the problem:

Don't think about the presentation side until you have a solution for the data side:

Some object to represent a question - including the text and a way to keep track of which is the correct answer.
Some way to populate a set of questions from a text file, building a collection of questions.

Now use a question object to populate a HTML page - presumably via JSP.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Online Quiz Application
 
Similar Threads
how show values in jsp from getting database
Problem with multiple variable declaration
Redirct page in Tilse with JSTL
how to show user objects in jsp page
no data in base