基于SSH框架的在线考试系统-毕业论文

数学与计算机科学学院毕业设计

}

HttpServletRequest request, HttpServletResponse response) {

QuestionForm qf= (QuestionForm)form;

IQuestionService ser = BOFactory.getQuestionService();

request.setAttribute(\,ser.findSubject(qf.getSubjectid())); this.saveToken(request);

return mapping.findForward(\);

@SuppressWarnings(\)

public ActionForward addquestiondo(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response) { ActionForward af = null;

if(this.isTokenValid(request)) {

try {

}

Options ops = new Options();

ops.setContent(qf.getOptions()[i]); ops.setQuestion(que); oplist.add(ops);

IQuestionService ser = BOFactory.getQuestionService(); QuestionForm qf= (QuestionForm)form; Question que = new Question(); que.setContent(qf.getContent()); que.setQtype(qf.getQtype()); String rans = \;

if(qf.getRightanswers()!=null)

for (int i=0;i

que.setRightanswer(rans); que.setScore(qf.getScore());

que.setSdate(Tools.d2sshort(new Date()));

que.setSubject(ser.findSubject(qf.getSubjectid()));

List oplist = new ArrayList(); if(qf.getOptions()!=null)

for (int i=0;i

rans += qf.getRightanswers()[i];

if(qf.getOptions()[i]!=null&&!qf.getOptions()[i].equals(\)) {

}

ser.addQuestion(que,oplist);

request.setAttribute(\,\增加试题成功\); af = mapping.findForward(\); this.resetToken(request);

} catch (RuntimeException e) {

34

数学与计算机科学学院毕业设计

}

}

}

e.printStackTrace();

request.setAttribute(\,\增加试题失败\); af = mapping.findForward(\);

}else {

request.setAttribute(\,\不要重复提交\); af = mapping.findForward(\);

return af;

6. 修改试题

//修改试题

public ActionForward updatequestiondo(ActionMapping mapping, ActionForm

HttpServletRequest request, HttpServletResponse response) { ActionForward af = null; try {

}

Options ops = new Options();

ops.setContent(qf.getOptions()[i]); ops.setQuestion(que); oplist.add(ops);

IQuestionService ser = BOFactory.getQuestionService(); QuestionForm qf= (QuestionForm)form;

Question que = ser.findQuestion(qf.getQuestionid()); que.setContent(qf.getContent()); que.setQtype(qf.getQtype()); String rans = \;

if(qf.getRightanswers()!=null)

for (int i=0;i

que.setRightanswer(rans); que.setScore(qf.getScore());

que.setSubject(ser.findSubject(qf.getSubjectid()));

List oplist = new ArrayList(); if(qf.getOptions()!=null)

for (int i=0;i

rans += qf.getRightanswers()[i];

form,

if(qf.getOptions()[i]!=null&&!qf.getOptions()[i].equals(\)) {

}

ser.updateQuestion(que,oplist);

request.setAttribute(\,\修改试题成功\);

35

数学与计算机科学学院毕业设计

}

}

af = mapping.findForward(\); this.resetToken(request); e.printStackTrace();

request.setAttribute(\,\修改试题失败\); af = mapping.findForward(\);

} catch (RuntimeException e) {

return af;

7. 删除试题 //删除试题 public ActionForward deletequestion(ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response) { QuestionForm qf = (QuestionForm)form;

IQuestionService ser = BOFactory.getQuestionService(); try {

ser.deleteQuestion(ser.findQuestion(qf.getQuestionid())); request.setAttribute(\,\删除成功\); } catch (RuntimeException e) {

e.printStackTrace();

request.setAttribute(\,\删除失败\); }

return mapping.findForward(\);

}

36

数学与计算机科学学院毕业设计

6 结束语

6.1全文总结

通过这次毕业设计,对很多东西有了新的认识和新的见解,认识问题的和思考解决办法有了本质上的进步,特别是对一个系统开发的模式有了更深的认识,对专业技能的运用更熟练。

网上考试系统的开发过程中也遇到了很多问题,开始做需求时不确定考试系统到底应该具备那些功能,只知道主要功能就是有试题能考试,但具体流程,怎样实现这些功能就很模糊,所以查看了很多资料才理清楚。数据库设计也是个难点,不明确要实现哪些功能就不能很好的把数据库设计好。设计数据库就是开发一个系统的核心。设计数据库一定要思路清晰,各个数据的流向各个表之间的关系一定要弄清楚,透彻。数据库设计出错了对以后整个系统的影响是最直接的。所以做需求时一定要做好需求分析,考虑完善,数据库设计要谨慎。总之需求分析时能做好就能降低需求变更,再加上设计时考虑到的技术可行性就可以大幅度的降低需求变更。 6.2心得体会

对于本次做的网上考试系统有很多的不足和不完善的地方。比如系统的有些功能操作不够人性话。提示不够准确,对管理信息的设置很不完善等。尤其是在题库的设计,没有设置试题的难易程度,学生考试就不能有层次性的进行测试了。

在当今信息时代,计算机技术与网络技术越来越广地成熟的应用于各个领域,同时也影响了教育领域的重大变革,网上考试系统也将更多更好的应用在教育教学领域中。以后的网上考试系统将会更加完善使用自己。

37

联系客服:779662525#qq.com(#替换为@)