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