Code:
public static CustomizedBean generatePaper(CustomizedBean paperAttribute,String []chapters)
{
Statement stmt = null;
String mcq = paperAttribute.getMcq(); //no of question specified by user
String fill = paperAttribute.getFill();//no of question specified by user
String trueFalse=paperAttribute.getTrueFalse();//no of question specified by user
String shortType = paperAttribute.getShort();//no of question specified by user
String mediumType = paperAttribute.getMedium();//no of question specified by user
String longType=paperAttribute.getLong();//no of question specified by user
/****************************************************************************************************/
String examName=paperAttribute.getExamName();
String DiffLevel=paperAttribute.getLevel(); //easy,moderate and hard
String FullMarks=paperAttribute.getFulllMarks();
try
{
currentCon = ConnectionManager.getConnection();
stmt=currentCon.createStatement();
for(String chapterId: chapters){
String CollectQuestionsQuery = "select questionId,chapterId from questionbank where chapterId='"+chapterId+"'";
rs=stmt.executeQuery(CollectQuestionsQuery);
rs.next();
int answerType=rs.getInt(1);
switch(answerType){
case 1:{//collect MCQ questions
String mcqQuestionQuery= "select * from questionbank where chapterId='"+chapterId+"'";
rsMcq=stmt.executeQuery(mcqQuestionQuery);
}
}
}
paperAttribute.valid=true;
stmt.close();
currentCon.close();
}
catch (Exception ex)
{
paperAttribute.valid=false;
System.out.println("An Exception has occurred: " + ex);
}
return paperAttribute;
}
}
i am lost here. I am trying to generate question paper. From jsp if user has 3 option to to choose difficulty level (easy,moderate and hard). Then based upon the difficult level it then goes for selecting question(based upon topic Id,msq,long,sho rt answer type supplied by the user). Then based upon that i want to selects all the question at once and send it to jsp via servlet.here i ll also have to take full marks in to account.
how can i keep all the questions and make it available for further processing