在多项选择的页面中
<logic:notEmpty name="stu_exam_mullist">
<logic:iterate id="mul" name="stu_exam_mullist" type="com.aftvc.exam.entity.MulQuestion" indexId="s" >
<div class="content-box">
<!-- Start Content Box -->
<div class="content-box-header">
<h3>第 <%= s+1 %>题</h3>
<ul class="content-box-tabs">
<!-- href must be unique and match the id of target div -->
</ul>
</div>
<!-- End .content-box-header -->
<div class="content-box-content">
<!-- End #tab1 -->
<div class="tab-content" id="tab2">
<div class="notification success png_bg">
<div class="conList">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left"><span class="conList"><strong>${mul.mq_question}</strong></span></td>
</tr>
<tr>
<td width="31" align="right">(A)</td>
<td width="559" align="left"> ${mul.mq_question_A}</td>
</tr>
<tr>
<td align="right">(B)</td>
<td align="left"> ${mul.mq_question_B}</td>
</tr>
<tr>
<td align="right">(C)</td>
<td align="left"> ${mul.mq_question_C}</td>
</tr>
<tr>
<td align="right">(D)</td>
<td align="left"> ${mul.mq_question_D}</td>
</tr>
</table>
</div>
</div>
</div>
<!-- End #tab2 -->
</div>
<!-- End .content-box-content -->
<div class="exam-box-selectAnswer">
<table width="760" border="0">
<tr>
<td><div align="left"><strong><span class="conList">选择答案:</span> <span class="conList">A</span>
<input type="checkbox" name="${mul.mq_id}" value="A" />
<span class="conList"> B</span>
<input type="checkbox" name="${mul.mq_id}" value="B" />
<span class="conList"> C</span>
<input type="checkbox" name="${mul.mq_id}" value="C" />
<span class="conList">
D</span>
<input type="checkbox" name="${mul.mq_id}" value="D" />
</strong></div></td>
</tr>
</table>
</div>
</div></logic:iterate></logic:notEmpty>在Action中///////////////////////////多选题///////////////////////////////
for(int i=0;i<stu_exam_mullist.size();i++)
{
MulQuestion mul=(MulQuestion)stu_exam_mullist.get(i);
System.out.println("多项选择题题目:"+mul.getMq_question());
System.out.println("多项选择题正确答案:"+mul.getMq_correntanswer());
mqid=String.valueOf(mul.getMq_id());
System.out.println("mq_id:"+mqid);
String[]answers=request.getParameterValues(mqid);
int subjectid=examInfoBiz.getEm_subject_idByEm_Exam_code(exam_code);
for(int j=i;j<answers.length;j++)
{
if(answers[j]==null){
System.out.println("你选的多项选择题答案:"+answers[j]);
System.out.println(exam_code+" 多项选择题tt");
questionScore=examInfoBiz.getExamquestionScore(3,exam_code);//题型分数,3为多项选择题
// studentAnswer.setSa_answer(answer);
// studentAnswer.setSa_exam_code(exam_code);//试卷号
// studentAnswer.setSa_question_id(3);//设置为多项选择题
// studentAnswer.setSa_question_no(judge.getJq_id());//题目号
// studentAnswer.setSa_stu_id(student.getStu_id());
// studentInfoBiz.insertStudentAnswer(studentAnswer);
continue;
}
else{
System.out.println("你选的多项选择题答案:"+answers[j]);
System.out.println(exam_code+" 多项选择题tt");
questionScore=examInfoBiz.getExamquestionScore(3,exam_code);//题型分数,3为多项选择题
studentAnswer.setSa_answer(answer);//有错
studentAnswer.setSa_exam_code(exam_code);//试卷号
studentAnswer.setSa_question_id(3);//设置为多项选择题
studentAnswer.setSa_question_no(mul.getMq_id());
studentAnswer.setSa_stu_id(student.getStu_id());
studentInfoBiz.insertStudentAnswer(studentAnswer);
if(mul.getMq_correntanswer().endsWith(answer))
{
judgeCorrentCount++;
totalJudgeScore=+judgeCorrentCount*questionScore;
}
else{
continue;
}
}
}
}
循环读取,你选择的多选题答案有错误,谁可以帮我把!!!!!!!循环代码内的内容写好,你们可以认为有20题,然后一题一题读取答案,没选的试题为答案为null,获得多项选择题的答案
<logic:notEmpty name="stu_exam_mullist">
<logic:iterate id="mul" name="stu_exam_mullist" type="com.aftvc.exam.entity.MulQuestion" indexId="s" >
<div class="content-box">
<!-- Start Content Box -->
<div class="content-box-header">
<h3>第 <%= s+1 %>题</h3>
<ul class="content-box-tabs">
<!-- href must be unique and match the id of target div -->
</ul>
</div>
<!-- End .content-box-header -->
<div class="content-box-content">
<!-- End #tab1 -->
<div class="tab-content" id="tab2">
<div class="notification success png_bg">
<div class="conList">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left"><span class="conList"><strong>${mul.mq_question}</strong></span></td>
</tr>
<tr>
<td width="31" align="right">(A)</td>
<td width="559" align="left"> ${mul.mq_question_A}</td>
</tr>
<tr>
<td align="right">(B)</td>
<td align="left"> ${mul.mq_question_B}</td>
</tr>
<tr>
<td align="right">(C)</td>
<td align="left"> ${mul.mq_question_C}</td>
</tr>
<tr>
<td align="right">(D)</td>
<td align="left"> ${mul.mq_question_D}</td>
</tr>
</table>
</div>
</div>
</div>
<!-- End #tab2 -->
</div>
<!-- End .content-box-content -->
<div class="exam-box-selectAnswer">
<table width="760" border="0">
<tr>
<td><div align="left"><strong><span class="conList">选择答案:</span> <span class="conList">A</span>
<input type="checkbox" name="${mul.mq_id}" value="A" />
<span class="conList"> B</span>
<input type="checkbox" name="${mul.mq_id}" value="B" />
<span class="conList"> C</span>
<input type="checkbox" name="${mul.mq_id}" value="C" />
<span class="conList">
D</span>
<input type="checkbox" name="${mul.mq_id}" value="D" />
</strong></div></td>
</tr>
</table>
</div>
</div></logic:iterate></logic:notEmpty>在Action中///////////////////////////多选题///////////////////////////////
for(int i=0;i<stu_exam_mullist.size();i++)
{
MulQuestion mul=(MulQuestion)stu_exam_mullist.get(i);
System.out.println("多项选择题题目:"+mul.getMq_question());
System.out.println("多项选择题正确答案:"+mul.getMq_correntanswer());
mqid=String.valueOf(mul.getMq_id());
System.out.println("mq_id:"+mqid);
String[]answers=request.getParameterValues(mqid);
int subjectid=examInfoBiz.getEm_subject_idByEm_Exam_code(exam_code);
for(int j=i;j<answers.length;j++)
{
if(answers[j]==null){
System.out.println("你选的多项选择题答案:"+answers[j]);
System.out.println(exam_code+" 多项选择题tt");
questionScore=examInfoBiz.getExamquestionScore(3,exam_code);//题型分数,3为多项选择题
// studentAnswer.setSa_answer(answer);
// studentAnswer.setSa_exam_code(exam_code);//试卷号
// studentAnswer.setSa_question_id(3);//设置为多项选择题
// studentAnswer.setSa_question_no(judge.getJq_id());//题目号
// studentAnswer.setSa_stu_id(student.getStu_id());
// studentInfoBiz.insertStudentAnswer(studentAnswer);
continue;
}
else{
System.out.println("你选的多项选择题答案:"+answers[j]);
System.out.println(exam_code+" 多项选择题tt");
questionScore=examInfoBiz.getExamquestionScore(3,exam_code);//题型分数,3为多项选择题
studentAnswer.setSa_answer(answer);//有错
studentAnswer.setSa_exam_code(exam_code);//试卷号
studentAnswer.setSa_question_id(3);//设置为多项选择题
studentAnswer.setSa_question_no(mul.getMq_id());
studentAnswer.setSa_stu_id(student.getStu_id());
studentInfoBiz.insertStudentAnswer(studentAnswer);
if(mul.getMq_correntanswer().endsWith(answer))
{
judgeCorrentCount++;
totalJudgeScore=+judgeCorrentCount*questionScore;
}
else{
continue;
}
}
}
}
循环读取,你选择的多选题答案有错误,谁可以帮我把!!!!!!!循环代码内的内容写好,你们可以认为有20题,然后一题一题读取答案,没选的试题为答案为null,获得多项选择题的答案
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货