File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to write jsp code for a quiz program---Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "How to write jsp code for a quiz program---Urgent" Watch "How to write jsp code for a quiz program---Urgent" New topic
Author

How to write jsp code for a quiz program---Urgent

Nidhi Juneja
Greenhorn

Joined: Oct 07, 2002
Posts: 27
Hello All...can any one give me an idea about what will be the logic behind making a mock exam style program. If I make a database of set of questions and answers and the answers type are mixed like a checkbox, radiobutton , textarea....how do I introduce this and also for a given user how is his answers stored in order to evaluate at the end
If anyone could suggest some links where i cud find such a code will be very helpful
Thanks
Nidhi
Deepak MP
Greenhorn

Joined: Dec 01, 2002
Posts: 11
Originally posted by Nidhi Juneja:
Hello All...can any one give me an idea about what will be the logic behind making a mock exam style program. If I make a database of set of questions and answers and the answers type are mixed like a checkbox, radiobutton , textarea....how do I introduce this and also for a given user how is his answers stored in order to evaluate at the end
If anyone could suggest some links where i cud find such a code will be very helpful
Thanks
Nidhi
Deepak MP
Greenhorn

Joined: Dec 01, 2002
Posts: 11
hi,
While making the database of questions & answers, you can have a column indicating the answers(in case of Multiple answers seperate it by some string(",")) and column in database indicating the type of answers i.e multiple answers[checkbox] or single answer[radiobutton] or editanswer[textarea]. The question can be displayed in a JSP, by making a call to JSP / Servlet (which in turn may request the database for next question OR can store all the questions along with it answers for a given test in a Java Object and get the information to be displayed from this object).
-----------
You can try the below logic to implement.
ValueInDatabase : is the value got for the column entry indicating the type of Question.
if (ValueInDatabase.equals("Single"))
{
//Implement display logic for JSP for Single Answer(i.e with RadioButtons)
}
if (ValueInDatabase.equals("Multiple"))
{
//Implement display logic for JSP for Multiple Answers Type (i.e with Check box)
}
if (ValueInDatabase.equals("TextArea"))
{
//Implement display logic for JSP for Text Area Answer type
}
-----------
Answers can be stored in HttpSession variable and then be compared at the end of the test.
I hope it help.
DEEPAK
 
GeeCON Prague 2014
 
subject: How to write jsp code for a quiz program---Urgent