• 大小: 19.2MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-18
  • 语言: 其他
  • 标签: 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\.settings\org.eclipse.jdt.core.prefs
     文件         568  2017-08-06 13:16  OnlineExamSystem\.settings\org.eclipse.wst.common.component
     文件         335  2017-08-06 13:16  OnlineExamSystem\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-08-06 13:16  OnlineExamSystem\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-08-06 13:16  OnlineExamSystem\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-09-20 14:09  OnlineExamSystem\build\
     目录           0  2017-09-20 14:15  OnlineExamSystem\build\classes\
     目录           0  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\
     文件        6185  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\ExamController.class
     文件        3787  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\LessonController.class
     文件        4103  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\ManagerController.class
     文件        3351  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\QuestionsController.class
     文件        8132  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\ResultController.class
     文件        5477  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\StudentController.class
     文件        4108  2017-09-20 14:12  OnlineExamSystem\build\classes\controller\TaoTiController.class
     文件         157  2017-09-20 14:15  OnlineExamSystem\build\classes\db.properties
     目录           0  2017-09-20 14:12  OnlineExamSystem\build\classes\exception\
     文件         634  2017-09-20 14:12  OnlineExamSystem\build\classes\exception\CustomException.class
     文件        1478  2017-09-20 14:12  OnlineExamSystem\build\classes\exception\CustomExceptionResolver.class
     目录           0  2017-09-20 14:12  OnlineExamSystem\build\classes\interceptor\
     文件        2343  2017-09-20 14:12  OnlineExamSystem\build\classes\interceptor\CheckIsLogin.class
     文件        2323  2017-09-20 14:12  OnlineExamSystem\build\classes\interceptor\CheckManagerIsLogin.class
     文件         344  2017-08-06 13:16  OnlineExamSystem\build\classes\log4j.properties
     目录           0  2017-09-20 14:12  OnlineExamSystem\build\classes\mapper\
     文件         827  2017-09-20 14:12  OnlineExamSystem\build\classes\mapper\LessonMapper.class
............此处省略1141个文件信息

评论

共有 条评论