代码:
<div style=" margin:0px auto; line-height:50px;text-align:center;">在线考试系统</div>
<form name="" action="./result.jsp?action=save" method="post">
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<%
Question question = new Question();
List<QuestionInfo> list = question.getList("");
int i = 1;
String choice = "";
for (QuestionInfo info : list) {
int hidQuestionCount = DataConverter.toInt(request.getParameter("hidQuestionCount"));//共有多少个题目
for (int j = 1; j <= hidQuestionCount; j++) {
if (i == j) {
choice = request.getParameter("choice" + j);//获取每一题的选项
}
}
%>
<tr>
<td height="30" bgcolor="#94A6DA" style="color:#ffffff;"><%=i%>、 <%=info.getTitle()%></td>
</tr>
<tr>
<td height="30">
<p>
你选择的答案是:<font color="#FF0000"><%=choice%> </font>, 正确答案是:<font color="blue"><%=info.getAnswer()%></font>
</p>
<p>
回答:<font color="#FF0000"> <%
if (choice.equals(info.getAnswer()))
out.print("正确");
else
out.print("错误");
%>
</font>
</p>
</td>
</tr>
<%
i++;
}
%>
</table>
<div style=" margin:0px auto; line-height:50px;text-align:center;">
<input type="submit" name="button" id="button" value="提交" onclick="return confirm('确定要提交吗?一经提交将无法修改!');" />
</div>
</form>