服务端框架界面
<frameset cols="*,1024,*">
<frame src="Teacher/empty.jsp" frameborder="0" noresize="noresize"
scrolling="no">
<frameset rows="30%,65%,*">
<frame src="Teacher/head.jsp" frameborder="0" noresize="noresize"
scrolling="no">
<frameset cols="18.3%,*">
<frame src="Teacher/left.jsp" frameborder="0" scrolling="no"
noresize="noresize">
<frame src="Teacher/right.jsp" name="right" id="right"
frameborder="0" scrolling="no" noresize="noresize">
</frameset>
<frame src="Teacher/foot.jsp" frameborder="0" noresize="noresize"
scrolling="no">
</frameset>
<frame src="Teacher/empty.jsp" frameborder="0" noresize="noresize"
scrolling="no">
</frameset>
题目界面
<body style="margin-top: 0"
background="/GraduationServer/images/right_bg.png">
<div>
<form method="post" action="Teacher/action.jsp"
name="questionListForm">
<input type="hidden" name="right" value="questionList">
<input type="hidden" name="taoti_id"
value="<%=studentTaoti.getTaoti_id()%>" />
<input type="hidden" name="singleQuestionID"
value="<%=singleQuestionID%>" />
<table width="95%" border="0" align="center" cellpadding="5"
cellspacing="1" bgcolor="#527FB4" class="tex001">
<caption class="cal_td07" style="padding: 1">
<font size="5"><b><%=studentTaoti.getTaoti_name()%></b> </font>
</caption>
<tr>
<td width="52%" height="25">
<input type="button" class="button" value="编辑题目"
οnclick="doEdit();">
<input type="button" class="button" value="删除题目"
οnclick="doQuesion();">
</td>
</tr>
</table>
<table width="95%" border="1" align="center" cellpadding="3"
cellspacing="0" bordercolordark="white"
style="border: 1px solid #527FB4">
<tr align="center" class="InfoTitle">
<td height="22" width="10%">
选择
</td>
<td align='center' width="10%">
题目类型
</td>
<td align='center' width="60%">
题目
</td>
<td align='center' width="10%">
答案
</td>
<td align='center' width="10%">
做错人数
</td>
</tr>
<%
int i = (currentPage - 1) * everyPageCount;
while (iterator2.hasNext())
{
StudentQuestions questions = iterator2.next();
out.println("<tr>");
out
.println("<td bgcolor='#E4EFFF' width='10%'><input type='checkbox' name='checkbox' value='"
+ questions.getPro_id()
+ "'>题 目 "
+ (++i)
+ "</td>");
if (questions.getPro_type() == 1)
{
out.println("<td align=center>" + "选择题" + " </td>");
out
.println("<td><textarea cols=55 rows=4 name='question_context' readonly='readonly'>"
+ i
+ ":"
+ questions.getProblem()
+ " "
+ questions.getPro_option_1()
+ questions.getPro_option_2()
+ questions.getPro_option_3()
+ questions.getPro_option_4()
+ "</textarea></td>");
out.println("<td align=center>" + questions.getPro_answer()
+ " </td>");
out.println("<td align=center>"
+ questions.getPro_false_number() + " </td>");
}
if (questions.getPro_type() == 2)
{
out.println("<td align=center>" + "填空题" + " </td>");
out
.println("<td><textarea cols=55 rows=4 name='question_context' readonly='readonly'>"
+ i
+ ":"
+ questions.getProblem()
+ "</textarea></td>");
out.println("<td align=center>" + questions.getPro_answer()
+ " </td>");
out.println("<td align=center>"
+ questions.getPro_false_number() + " </td>");
}
if (questions.getPro_type() == 3)
{
out.println("<td align=center>" + "判断题" + " </td>");
out
.println("<td><textarea cols=55 rows=2 name='question_context' readonly='readonly'>"
+ i
+ ":"
+ questions.getProblem()
+ "</textarea></td>");
out.println("<td align=center>" + questions.getPro_answer()
+ " </td>");
out.println("<td align=center>"
+ questions.getPro_false_number() + " </td>");
}
out.println("</tr>");
}
%>
</table>
<table width="95%" border="1" align="center" cellpadding="3"
cellspacing="0" bordercolordark="white"
style="border: 1px solid #527FB4">
<tr>
<td align='left' colspan="5">
<%
if (allCount > 0)
{
%>
<a
href="javascript:parent.right.location='question.jsp?currentPage=<%=1%>&strID=<%=taotiId%>'"><span>首页</span>
</a>
<%
}
%>
<%
if (currentPage != 1 && allCount > 0)
{
%><a
href="javascript:parent.right.location='question.jsp?currentPage=<%=currentPage - 1%>&strID=<%=taotiId%>'"><span>上一页</span>
</a>
<%
}
%>
<%
if (currentPage != allPage && allCount > 0)
{
%><a
href="javascript:parent.right.location='question.jsp?currentPage=<%=currentPage + 1%>&strID=<%=taotiId%>'"><span>下一页</span>
</a>
<%
}
%>
<%
if (allCount > 0)
{
%>
<a
href="javascript:parent.right.location='question.jsp?currentPage=<%=allPage%>&strID=<%=taotiId%>'">尾页</a>
<%
}
%>
</td>
<td align="right">
共 <%=allCount%> 项 第 <%=currentPage%> 页
</td>
</tr>
</table>
</form>
</div>
</body>
action.jsp代码
<%
request.setCharacterEncoding("utf-8");
String right = (String) request.getParameter("right");
String currentUserName = (String) session.getAttribute("username");
StudentTaotiBiz studentTaotiBiz = new StudentTaotiBizImpl();
String taotiName = "";
String taotiTime = "";
String taotiScore = "";
String taotiDescri = "";
String lessonId = "";
String taotiId = "";
String strMsgInfo = "";
String proType = "";
String problem = "";
String proScore = "";
String proOption1 = "";
String proOption2 = "";
String proOption3 = "";
String proOption4 = "";
String proAnswer = "";
String questionID = "";
String lesson_name = "";
if (right.equals("addtaoti"))
{
lessonId = request.getParameter("lesson_name");
taotiName = request.getParameter("taoti_name");
taotiTime = request.getParameter("taoti_time");
taotiScore = request.getParameter("taoti_score");
taotiDescri = request.getParameter("taoti_desc");
if (studentTaotiBiz.isInsertTaotiUniqueBiz(taotiName))
{
studentTaotiBiz.insertTaotiBiz(taotiName, Integer
.parseInt(taotiTime), Integer.parseInt(taotiScore),
((taotiDescri == null) ? "" : taotiDescri), Integer
.parseInt(lessonId));
strMsgInfo = "试卷添加成功!";
}
else
{
strMsgInfo = "新增试卷:名称 " + taotiName + "已存在!!!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out.println("<script>parent.right.location.href='"
+ "right.jsp" + "';</script>");
}
else if (right.equals("updatetaoti"))
{
taotiId = request.getParameter("taotiid");
taotiName = request.getParameter("taoti_name");
taotiTime = request.getParameter("taoti_time");
taotiScore = request.getParameter("taoti_score");
taotiDescri = request.getParameter("taoti_desc");
boolean flag = studentTaotiBiz.updateTaotiByIdBiz(taotiId,
taotiName, taotiTime, taotiScore, taotiDescri);
if (flag)
{
strMsgInfo = "试卷更新成功!";
}
else
{
strMsgInfo = "试卷更新失败!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out.println("<script>parent.right.location.href='"
+ "taoti_list.jsp" + "';</script>");
}
else if (right.equals("insertquestion"))
{
taotiId = request.getParameter("taoti_id");
proType = request.getParameter("pro_type");
problem = request.getParameter("question");
proScore = request.getParameter("pro_score");
proOption1 = request.getParameter("pro_option_1");
proOption2 = request.getParameter("pro_option_2");
proOption3 = request.getParameter("pro_option_3");
proOption4 = request.getParameter("pro_option_4");
proAnswer = request.getParameter("pro_answer");
StudentQuestionsBiz studentQuestionsBiz = new StudentQuestionsBizImpl();
boolean flag = studentQuestionsBiz.insertQuestionBiz(taotiId,
proType, problem, proScore, proOption1, proOption2,
proOption3, proOption4, proAnswer);
if (flag)
{
strMsgInfo = "添加题目成功!";
}
else
{
strMsgInfo = "题目添加失败!!!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out
.println("<script>parent.right.location.href='"
+ "insertquestion.jsp?strID=" + taotiId
+ "';</script>");
}
else if (right.equals("updatequestion"))
{
taotiId = request.getParameter("taoti_id");
questionID = request.getParameter("question_id");
problem = request.getParameter("question");
proScore = request.getParameter("pro_score");
proOption1 = request.getParameter("pro_option_1");
proOption2 = request.getParameter("pro_option_2");
proOption3 = request.getParameter("pro_option_3");
proOption4 = request.getParameter("pro_option_4");
proAnswer = request.getParameter("pro_answer");
StudentQuestionsBiz studentQuestionsBiz = new StudentQuestionsBizImpl();
boolean flag = studentQuestionsBiz.updateQuestionByIdBiz(
questionID, problem, proScore, proOption1, proOption2,
proOption3, proOption4, proAnswer);
if (flag)
{
strMsgInfo = "更新题目成功!";
}
else
{
strMsgInfo = "更新题目失败!!!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out.println("<script>parent.right.location.href='"
+ "question.jsp?strID=" + taotiId + "';</script>");
}
else if (right.equals("deleteQuestion"))
{
taotiId = request.getParameter("strID");
questionID = request.getParameter("questionID");
StudentQuestionsBiz studentQuestionsBiz = new StudentQuestionsBizImpl();
boolean flag = studentQuestionsBiz
.deleteQuestionByIdBiz(questionID);
if (flag)
{
strMsgInfo = "删除题目成功!";
}
else
{
strMsgInfo = "删除题目失败!!!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out.println("<script>parent.right.location.href='"
+ "question.jsp?strID=" + taotiId + "';</script>");
}
else if (right.equals("insertlesson"))
{
lesson_name = request.getParameter("lesson_name");
StudentLessonsBiz studentLessonsBiz = new StudentLessonsBizImpl();
if (studentLessonsBiz.isInsertLessonUniqueBiz(lesson_name,
currentUserName))
{
boolean flag = studentLessonsBiz.insertLessonBiz(
lesson_name, currentUserName);
if (flag)
{
strMsgInfo = "添加课程成功!";
}
else
{
strMsgInfo = "添加课程失败!!!";
}
}
else
{
strMsgInfo = "已经有本课程!!!";
}
out.println("<script>parent.alert('" + strMsgInfo
+ "')</script>");
out.println("<script>parent.right.location.href='"
+ "insertlesson.jsp" + "';</script>");
}
%>
系统测试
public class Test extends TestCase
{
StudentInfoBiz studentInfoBiz = new StudentInfoBizImpl();
StudentLessonsBiz studentLessonsBiz = new StudentLessonsBizImpl();
StudentTaotiBiz studentTaotiBiz = new StudentTaotiBizImpl();
StudentQuestionsBiz studentQuestionsBiz = new StudentQuestionsBizImpl();
StudentScoreBiz studentScoreBiz = new StudentScoreBizImpl();
TeacherLoginBiz teacherLoginBiz = new TeacherLoginBizImpl();
public void testQueryStudentByID()
{
HashMap<String, String> param = new HashMap<String, String>();
param.put(SQLUtil.ST_INFO_STUDENT_ID, "2");
param.put(SQLUtil.ST_INFO_STUDENT_PWD, "遮天");
List<StudentInfo> list = studentInfoBiz.queryStudentInfo(param);
Iterator<StudentInfo> i = list.iterator();
while (i.hasNext())
{
StudentInfo studentInfo = i.next();
System.out.println(studentInfo.getStudent_id() + " "
+ studentInfo.getStudent_name() + " "
+ studentInfo.getStudent_pwd());
}
}
}