package com.taohan.online.exam.handler;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import oracle.net.aso.l;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.mysql.fabric.Response;
import com.taohan.online.exam.po.*;
import com.taohan.online.exam.service.*;
/**
*
* <p>Title: StudentInfoHandler</p>
* <p>Description: </p>
* @author: taohan
* @date: 2018-8-16
* @time: 上午10:22:22
* @version: 1.0
*/
@Controller
@SuppressWarnings("all")
public class StudentInfoHandler {
@Autowired
private StudentInfoService studentInfoService;
@Autowired
private ClassInfoService classInfoService;
@Autowired
private ExamSubjectMiddleInfoService examSubjectMiddleInfoService;
@Autowired
private ExamHistoryPaperService examHistoryPaperService;
@Autowired
private ExamChooseInfoService examChooseInfoService;
@Autowired
private ExamSubjectMiddleInfo esm;
@Autowired
private ClassInfo classInfo;
@Autowired
private ExamPaperInfo examPaper;
@Autowired
private GradeInfo grade;
@Autowired
private StudentInfo student;
@Autowired
private ExamPaperInfoService examPaperInfoService;
private Logger logger = Logger.getLogger(StudentInfoHandler.class);
/**
* 获取学生集合
* @param studentId 学生编号
* @param classId 班级编号
* @param gradeId 年级编号
* @param startPage 起始页 default=1
* @param pageShow 页容量 default=10
* @return
*/
@RequestMapping("/students")
public ModelAndView getCourses(@RequestParam(value = "studentId", required = false) Integer studentId,
@RequestParam(value = "classId", required = false) Integer classId,
@RequestParam(value = "gradeId", required = false) Integer gradeId,
@RequestParam(value="startPage", required=false, defaultValue="1") Integer startPage,
@RequestParam(value="pageShow", required=false, defaultValue="10") Integer pageShow ) {
logger.info("获取学生集合 classId="+classId+", gradeId="+gradeId+", startPage="+startPage+", pageShow="+pageShow);
ModelAndView model = new ModelAndView();
model.setViewName("/admin/students");
//查询条件处理
StudentInfo student = new StudentInfo();
if (studentId != null)
student.setStudentId(studentId);
if (classId != null) {
classInfo.setClassId(classId);
student.setClassInfo(classInfo);
}
if (gradeId != null) {
grade.setGradeId(gradeId);
student.setGrade(grade);
}
Map<String, Object> map = new HashMap<String, Object>();
//计算当前查询起始数据索引
int startIndex = (startPage-1) * pageShow;
map.put("student", student);
map.put("startIndex", startIndex);
map.put("pageShow", pageShow);
List<StudentInfo> students = studentInfoService.getStudents(map);
model.addObject("students", students);
//获取学生总量
int studentTotal = studentInfoService.getStudentTotal();
//计算总页数
int pageTotal = 1;
if (studentTotal % pageShow == 0)
pageTotal = studentTotal / pageShow;
else
pageTotal = studentTotal / pageShow + 1;
model.addObject("pageTotal", pageTotal);
model.addObject("pageNow", startPage);
return model;
}
/**
* 根据编号获取学生信息
* @param studentId
* @return
*/
@RequestMapping("/student/{studentId}")
public ModelAndView getCourseById(@PathVariable("studentId") Integer studentId) {
logger.info("获取学生 " + studentId);
ModelAndView model = new ModelAndView();
model.setViewName("/admin/studentedit");
StudentInfo student = studentInfoService.getStudentById(studentId);
model.addObject("student", student);
List<ClassInfo> classes = classInfoService.getClasses(null);
model.addObject("classes", classes);
return model;
}
/**
* 添加/修改学生信息
* @param studentId
* @param isUpdate 操作标识
* @param studentName
* @param studentAccount
* @param studentPwd
* @param classId
* @return
*/
@RequestMapping(value = "/student/student", method = RequestMethod.POST)
public String isUpdateOrAddCourse(
@RequestParam(value = "studentId", required = false) Integer studentId,
@RequestParam(value = "isupdate", required = false) Integer isUpdate,
@RequestParam(value = "studentName", required = false) String studentName,
@RequestParam("studentAccount") String studentAccount,
@RequestParam("studentPwd") String studentPwd,
@RequestParam("classId") Integer classId) {
StudentInfo student = new StudentInfo();
student.setStudentId(studentId);
student.setStudentName(studentName);
student.setStudentAccount(studentAccount);
student.setStudentPwd(studentPwd);
classInfo.setClassId(classId);
student.setClassInfo(classInfo);
if (isUpdate != null) {
logger.info("修改学生 " + student + " 的信息");
int row = studentInfoService.isUpdateStudent(student);
} else {
logger.info("添加学生 " + student + " 的信息");
int row = studentInfoService.isAddStudent(student);
}
return "redirect:/students";
}
/**
* 删除学生
* @param studentId
* @return
*/
@RequestMapping(value = "/student/{studentId}", method = RequestMethod.DELETE)
public String isDelTeacher(@PathVariable("studentId") Integer studentId) {
logger.info("删除学生 " + studentId);
int row = studentInfoService.isDelStudent(studentId);
return "redirect:/students";
}
/**
* 预添加学生
* @return
*/
@RequestMapping("/preAddStudent")
public ModelAndView preAddStudent() {
logger.info("预添加学生信息");
ModelAndView model = new ModelAndView();
model.setViewName("/admin/studentedit");
List<ClassInfo> classes = classInfoService.getClasses(null);
model.addObject("classes", classes);
return model;
}
/**
* 学生考试登录验证
*
* 此处验证并不合理 登录验证实现如下:
* 前台学生登录传入账户,后台根据账户获取学生密码
* 返回学生密码,前台登录焦点离开密码框使用 JavaScript 判断
*
* @param studentAccount 学生登录账户
* @param response
* @throws IOException
*/
@RequestMapping("/validateLoginStudent")
public void validateLoginStudent(@RequestParam("studentAccount") String studentAccount,
HttpServletResponse response) throws IOException {
logger.info("学生账户 "+studentAccount+",尝试登录考试");
//获取需要登录的学生对象
StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
if (student == null) {
logger.error("登录学生账户 "+studentAccount+" 不存在");
response.getWriter().print("n");
} else {
logger.error("登录学生账户 "+studentAccount+" 存在");
response.getWriter().print(student.getStudentPwd());
}
}
/**
* 学生登录考试
* @param student 登录学生
* @param request
* @return
*/
@RequestMapping(value="/studentLogin", method=RequestMethod.POST)
public ModelAndView studentLogin(StudentInfo student, HttpServletRequest request) {
ModelAndView model = new ModelAndView();
StudentInfo loginStudent = studentInfoService.getStudentByAccountAndPwd(student.getStudentAccount());
logger.info("学生 "+loginStudent+" 有效登录");
if(loginStudent == null || !student.getStudentPwd().equals(loginStudent.getStudentPwd())){
model.setViewName("reception/
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
一、项目简介 本项目是一套基于ssm框架实现的Java web在线考试系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本等,该项目附带全部源码可作为毕设使用。 项目都经过严格调试,eclipse 确保可以运行! 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值 二、技术实现 后端:spring,springmvc,mybatis,mysql,面向对象 前端采用:jsp,jquery,css,echarts 运行环境及开发工具:jdk8,idea或者eclipse,Navicat 三、系统功能 在线考试分为前后台 主要功能包括: 用户的登录,注册 考试中心,考试历史 进入考试,回顾试卷 系统首页:统计试卷数量,教师人数,题目数量,学生人数 年级管理,科目管理,班级管理模块,教师功能模块,学生管理功能,试卷管理模块,试题管理模块:展示所有试题信息,导入试题等 详见:https://blog.csdn.net/weixin_43860634/article/details/128464086
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm框架实现的Java web在线考试系统 (671个子文件)
file_manager_json.ashx 6KB
upload_json.ashx 3KB
UpLoad_Class.asp 16KB
file_manager_json.asp 6KB
JSON_2.0.4.asp 5KB
upload_json.asp 3KB
demo.asp 2KB
demo.aspx 2KB
StudentInfoHandler.class 17KB
SubjectInfoHandler.class 14KB
ExamSubjectMiddleInfoHandler.class 11KB
ClassInfoHandler.class 9KB
ExamPlanInfoHandler.class 8KB
StudentExamInfoCharts.class 8KB
TeacherInfoHandler.class 8KB
ExamPaperInfoHandler.class 6KB
StudentCount.class 5KB
SubjectImportUtil.class 5KB
CourseInfoHandler.class 5KB
GradeInfoHandler.class 5KB
SubjectInfo.class 5KB
StudentExamInfoHandler.class 4KB
ExamChooseInfoHandler.class 4KB
ExamPaperServiceImpl.class 3KB
ExamPaperInfo.class 3KB
TeacherInfo.class 3KB
AdminHomeHandler.class 3KB
TeacherInfoTest.class 3KB
StudentInfo.class 2KB
StudentInfoTest.class 2KB
ExamChooseInfo.class 2KB
StudentExamInfo.class 2KB
ExamPlanInfo.class 2KB
StudentInfoServiceImpl.class 2KB
TeacherInfoServiceImpl.class 2KB
ClassInfoServiceImpl.class 2KB
ExamSubjectMiddleInfoTest.class 2KB
ExamHistoryInfo.class 2KB
SubjectInfoServiceImpl.class 2KB
ExamChooseInfoServiceImpl.class 2KB
ClassInfo.class 2KB
CourseInfo.class 2KB
ExamHistoryInfoHandler.class 2KB
ExamHistoryPaper.class 2KB
ExamPlanInfoServiceImpl.class 2KB
ExamSubjectMiddleInfo.class 2KB
ExamSubjectMiddleInfoServiceImpl.class 2KB
ExamHistoryPaperServiceImpl.class 2KB
CourseInfoServiceImpl.class 2KB
LoginInterceptor.class 1KB
GradeInfoServiceImpl.class 1KB
GradeInfo.class 1KB
StudentExamInfoServiceImpl.class 1KB
ClassInfoMapper.class 987B
ExamPaperInfoService.class 958B
ExamPaperInfoMapper.class 956B
ClassInfoService.class 915B
StudentInfoService.class 903B
StudentInfoMapper.class 897B
ExamChooseInfoService.class 880B
ExamChooseInfoMapper.class 874B
TeacherInfoService.class 787B
TeacherInfoMapper.class 781B
SubjectInfoService.class 767B
ExamSubjectMiddleInfoService.class 762B
SubjectInfoMapper.class 761B
ExamSubjectMiddleInfoMapper.class 756B
ExamHistoryPaperService.class 672B
ExamPlanInfoService.class 671B
ExamHistoryPaperMapper.class 666B
ExamPlanInfoMapper.class 665B
CourseInfoService.class 619B
CourseInfoMapper.class 613B
GradeInfoService.class 533B
GradeInfoMapper.class 527B
StudentExamInfoService.class 472B
StudentExamInfoMapper.class 466B
StringUtil.class 311B
.classpath 661B
org.eclipse.wst.common.component 491B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 143KB
bootstrap.min.css 118KB
jquery-ui-1.9.2.custom.css 30KB
jquery-ui-1.9.2.custom.min.css 26KB
bootstrap-theme.css 26KB
zeroModal.css 23KB
bootstrap-theme.min.css 23KB
default.css 21KB
jedate.css 11KB
bootstrap-select.min.css 10KB
404.css 4KB
jeDate-test.css 3KB
qq.css 3KB
simple.css 2KB
prettify.css 973B
form-public.css 412B
index.css 282B
public.css 33B
LitJSON.dll 49KB
共 671 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
- 少微。2023-04-23内容与描述一致,超赞的资源,值得借鉴的内容很多,支持!
- m0_743977902023-06-10资源不错,很实用,内容全面,介绍详细,很好用,谢谢分享。
- 2201_757616172024-03-30实在是宝藏资源、宝藏分享者!感谢大佬~
飞翔的佩奇
- 粉丝: 3520
- 资源: 796
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功