SSM在线考试系统


SSm(Spring、SpringMVC和Mybatis)开发的在线考试系统 包括前后台,
资源截图
代码片段和文件信息
package controller;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpSession;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import po.Exam;
import po.Questions;
import po.QuestionsCustom;
import po.Student;
import po.Studentresult;
import po.StudentresultCustom;
import po.Taoti;
import service.QuestionsService;
import service.ResultService;
import service.StudentService;
import service.TaotiService;

@Controller
public class ExamController {
@Autowired
private TaotiService taotiService;

@Autowired
private QuestionsService questionsService;

@Autowired
private StudentService studentService;

@Autowired
private ResultService resultService;

@RequestMapping(“/toExam.action“)
public String toExam() throws Exception{
return “/exam“;
}

@RequestMapping(“/toExamPage.action“)
public ModelAndView toExamPage(Integer lessonid) throws Exception{
ModelAndView modelAndView=new ModelAndView();
List list = taotiService.findListByLessonid(lessonid);
if (list.size()>0) {
Integer length=list.size();
Integer index=(int) (Math.random()*(length-1));
Taoti taoti=list.get(index);
List list2 = questionsService.findListByTaotiid(taoti.getId());
modelAndView.addobject(“list“ list2);
}else {
modelAndView.addobject(“list“ null);
}
modelAndView.setViewName(“/examPage“);
return modelAndView;
}

@RequestMapping(“/postExam.action“)
public ModelAndView postExam(Exam examHttpSession session) throws Exception{
ModelAndView modelAndView=new ModelAndView();

Studentresult studentresult=new Studentresult();

Map map = exam.getAnswerMap();
Set keySet=map.keySet();
Iterator it=keySet.iterator();
Integer singleGrade=0;
Integer doubleGrade=0;
Integer taotiId=null;
while(it.hasNext()) {
Integer key=it.next();
String value=map.get(key);

Questions questions = questionsService.findById(key);
if(taotiId == null) {
taotiId=questions.getTaotiid();
}
if(questions.getType().equals(“单选“)) {
if(questions.getAnswer().equals(value)) {
singleGrade+=10;
}
}else {
if(questions.getAnswer().equals(value)) {
doubleGrade+=20;
}
}
}
Integer totalGrade=singleGrade+doubleGrade;

Taoti taoti = taotiService.fintOneById(taotiId);

String examnumber=“CN“;
SimpleDateFormat simpleDateFormat=new SimpleDateFormat(“yyyyMMdd“);
Date date=new Date();
String strD = simpleDateFormat.format(date);
object studentName = session.getAttribute(“studentName“);
String studentId=null;
if(studentName!=null) {
String studentName2

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-09-20 14:09  OnlineExamSystem
     文件         816  2017-09-20 14:10  OnlineExamSystem.classpath
     文件           8  2017-08-06 13:16  OnlineExamSystem.gitignore
     文件         885  2017-08-06 13:16  OnlineExamSystem.project
     目录           0  2017-09-20 14:09  OnlineExamSystem.settings
     文件         555  2017-08-06 13:16  OnlineExamSystem.settings.jsdtscope
     文件         357  2017-08-06 13:16  OnlineExamSystem.settingsorg.eclipse.jdt.core.prefs
     文件         568  2017-08-06 13:16  OnlineExamSystem.settingsorg.eclipse.wst.common.component
     文件         335  2017-08-06 13:16  OnlineExamSystem.settingsorg.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-08-06 13:16  OnlineExamSystem.settingsorg.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-08-06 13:16  OnlineExamSystem.settingsorg.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-09-20 14:09  OnlineExamSystemuild
     目录           0  2017-09-20 14:15  OnlineExamSystemuildclasses
     目录           0  2017-09-20 14:12  OnlineExamSystemuildclassescontroller
     文件        6185  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerExamController.class
     文件        3787  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerLessonController.class
     文件        4103  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerManagerController.class
     文件        3351  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerQuestionsController.class
     文件        8132  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerResultController.class
     文件        5477  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerStudentController.class
     文件        4108  2017-09-20 14:12  OnlineExamSystemuildclassescontrollerTaoTiController.class
     文件         157  2017-09-20 14:15  OnlineExamSystemuildclassesdb.properties
     目录           0  2017-09-20 14:12  OnlineExamSystemuildclassesexception
     文件         634  2017-09-20 14:12  OnlineExamSystemuildclassesexceptionCustomException.class
     文件        1478  2017-09-20 14:12  OnlineExamSystemuildclassesexceptionCustomExceptionResolver.class
     目录           0  2017-09-20 14:12  OnlineExamSystemuildclassesinterceptor
     文件        2343  2017-09-20 14:12  OnlineExamSystemuildclassesinterceptorCheckIsLogin.class
     文件        2323  2017-09-20 14:12  OnlineExamSystemuildclassesinterceptorCheckManagerIsLogin.class
     文件         344  2017-08-06 13:16  OnlineExamSystemuildclasseslog4j.properties
     目录           0  2017-09-20 14:12  OnlineExamSystemuildclassesmapper
     文件         827  2017-09-20 14:12  OnlineExamSystemuildclassesmapperLessonMapper.class
............此处省略1141个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)