基于javaweb的作业管理系统(java+springboot+bootstrap+html+thymeleaf+mysql)

基于javaweb的作业管理系统(java+springboot+bootstrap+html+thymeleaf+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220519002625

20220519002626

20220519002627

20220519002628

20220519002630

20220519002631

基于javaweb+SpringBoot的作业管理系统(java+SpringBoot+BootStrap+HTML+Thymeleaf+mysql)

项目介绍

该项目分为学生、教师两个角色,主要功能如下:

  1. 学生模块

1) 我的课程:学生可在此页面自由选课 2) 我的作业:可查看选择的课程已发布的作业及完成情况,并可选择完成作业或查看详情

  1. 教师模块

1) 学生管理: I. 查询学生:可根据学生信息搜索学生,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作 II. 添加学生:可进行单个添加学生或excel表格导入学生 2) 教师管理: I. 查询教师:可根据教师信息搜索教师,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作 II. 添加教师:可进行单个添加学生或excel表格导入教师 3) 班级管理: I. 查询班级:可查看所有班级,进行删除修改等操作 II. 添加班级:可进行添加班级操作 4) 课程管理: I. 查询课程:可查看所有课程,进行修改删除操作 II. 添加班级:可进行添加课程操作 5) 作业管理: I. 查看作业完成情况:可查看每门科目项目学生作业的完成情况,可根据起止时间和课程名称进行搜索。 II. 添加作业:选择一门课程搜索题库,在题库中选择题目后进行作业发布操作 III. 编辑题库:可对题库进行增删改操作

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;

6.是否Maven项目:是

技术栈

  1. 后端:SpringBoot+Mybatis+Thymeleaf模板引擎

  2. 前端:HTML+CSS+JavaScript+BootStrap

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录 教师账号:js 密码:123456 学生账号:wangyi 密码:123456

老师管理控制层:

/**

  • Title: TeacherInfoHandler

  • Descriiption: 教师

*/

@Controller

@SuppressWarnings(“all”)

public class TeacherInfoHandler {

@Autowired

private TeacherInfoService teacherInfoService;

private Logger logger = Logger.getLogger(TeacherInfoHandler.class);

/**

  • 获取 验证教师信息

  • @param teacherAccount

  • @param response

  • @throws Exception

*/

@RequestMapping(value = “/validateTeacher”, method = RequestMethod.POST)

public void queryTeacherExists(@RequestParam(value = “account”) String teacherAccount, HttpServletResponse response)

throws Exception {

logger.info(“获取教师 " + teacherAccount + " 的信息”);

TeacherInfo teacherInfo = null;

teacherInfo = teacherInfoService.getTeacherByAccount(teacherAccount);

// 教师账户不存在

if (teacherInfo == null) {

response.getWriter().print(“1”);

} else {

response.getWriter().print(teacherInfo.getTeacherPwd());

/**

  • 教师登录

  • @param teacherAccount

  • @param request

  • @return

*/

@RequestMapping(value = “/teacherlogin”, method = RequestMethod.POST)

public String teacherLogin(@RequestParam(“teacherAccount”) String teacherAccount, HttpServletRequest request) {

if (teacherAccount == null || “”.equals(teacherAccount)) {

logger.error(“教师账号为空”);

request.setAttribute(“error”, “登录信息有误”);

return “/error”;

logger.info(“教师 " + teacherAccount + " 登录”);

// 获取当前登录教师

TeacherInfo teacherInfo = teacherInfoService.getTeacherByAccount(teacherAccount);

if (teacherInfo == null) {

logger.error(“教师账号为空”);

request.setAttribute(“error”, “账号不存在!”);

return “/error”;

String teacherPwd = request.getParameter(“teacherPwd”);

if (!teacherInfo.getTeacherPwd().equals(teacherPwd)) {

logger.error(“密码错误”);

request.setAttribute(“error”, “密码错误!”);

return “/error”;

// 将当前登录教师 后台权限存入 Session

request.getSession().setAttribute(“adminPower”, teacherInfo.getAdminPower());

request.getSession().setAttribute(“loginTeacher”, teacherInfo);

return “redirect:admin/index.jsp”;

/**

  • 教师查看自己的信息

  • @param teacherId

  • @return

*/

@RequestMapping(“/selfinfo/{teacherId}”)

public ModelAndView loginTeacherSelf(@PathVariable(“teacherId”) Integer teacherId) {

ModelAndView model = new ModelAndView();

logger.error(“教师 " + teacherId + " 查看自己的信息”);

if (teacherId == null) {

model.setViewName(“…/error”);

return model;

} else {

List teachers = new ArrayList();

TeacherInfo teacher = teacherInfoService.getTeacherById(teacherId);

teachers.add(teacher);

model.addObject(“teachers”, teachers);

model.setViewName(“/admin/teacher/teachers”);

return model;

/**

  • 教师退出登录

  • @throws IOException

*/

@RequestMapping(“/exitTeacher”)

public void exitTeacher(HttpSession session, HttpServletResponse response) throws IOException {

session.removeAttribute(“loginTeacher”);

session.removeAttribute(“adminPower”);

response.sendRedirect(“admin/login.jsp”);

/**

  • 查询教师集合

  • @param startPage

  • @param pageShow

  • @return

*/

@RequestMapping(value = “/teachers”, method = RequestMethod.GET)

public ModelAndView getTeachers(

@RequestParam(value = “startPage”, required = false, defaultValue = “1”) Integer startPage, // 当前页码,默认第一页

@RequestParam(value = “pageShow”, required = false, defaultValue = “10”) Integer pageShow /*

  • 每页显示数据量

  • 默认10条

*/) {

logger.info(“查询教师集合”);

ModelAndView model = new ModelAndView();

model.setViewName(“admin/teacher/teachers”);

List teachers;

Map<String, Object> map = new HashMap<String, Object>();

// 计算当前查询起始数据索引

int startIndex = (startPage - 1) * pageShow;

map.put(“startIndex”, startIndex);

map.put(“pageShow”, pageShow);

map.put(“teacher”, null);

teachers = teacherInfoService.getTeachers(map);

model.addObject(“teachers”, teachers);

// 获取教师总量

int teacherTotal = teacherInfoService.getTeacherTotal();

// 计算总页数

int pageTotal = 1;

if (teacherTotal % pageShow == 0)

pageTotal = teacherTotal / pageShow;

else

pageTotal = teacherTotal / pageShow + 1;

model.addObject(“pageTotal”, pageTotal);

model.addObject(“pageNow”, startPage);

return model;

/**

  • 预修改教师

  • @param teacherId

  • @return

*/

@RequestMapping(value = “/teacher/{teacherId}”, method = RequestMethod.GET)

public ModelAndView preUpdateTeacher(@PathVariable(“teacherId”) Integer teacherId) {

logger.info(“预修改教师处理”);

ModelAndView model = new ModelAndView();

// 获取要修改教师

TeacherInfo teacher = teacherInfoService.getTeacherById(teacherId);

model.setViewName(“/admin/teacher/teacheredit”);

model.addObject(“teacher”, teacher);

return model;

/**

  • 修改/添加 教师

  • @param teacherId

  • @param isUpdate

  •        操作标识
    
  • @param teacherName

  • @param teacherAccount

  • @param teacherPwd

  • @param adminPower

  • @return

*/

@RequestMapping(value = “/teacher/teacher”, method = RequestMethod.POST)

public String isUpdateOrAddTeacher(@RequestParam(value = “teacherId”, required = false) Integer teacherId,

@RequestParam(value = “isupdate”, required = false) Integer isUpdate,

@RequestParam(“teacherName”) String teacherName, @RequestParam(“teacherAccount”) String teacherAccount,

@RequestParam(“teacherPwd”) String teacherPwd, @RequestParam(“adminPower”) Integer adminPower) {

TeacherInfo teacher = new TeacherInfo();

teacher.setTeacherId(teacherId);

teacher.setTeacherName(teacherName);

teacher.setTeacherAccount(teacherAccount);

teacher.setTeacherPwd(teacherPwd);

teacher.setAdminPower(adminPower);

if (isUpdate != null) { // 修改

logger.info(“修改教师 " + teacher + " 的信息”);

int row = teacherInfoService.isUpdateTeacherInfo(teacher);

} else { // 添加

logger.info(“添加教师 " + teacher + " 的信息”);

int row = teacherInfoService.isAddTeacherInfo(teacher);

return “redirect:/teachers”;

/**

  • 删除教师

  • @param teacherId

  • @return

*/

@RequestMapping(value = “/teacher/{teacherId}”, method = RequestMethod.DELETE)

public String isDelTeacher(@PathVariable(“teacherId”) Integer teacherId) {

logger.info("删除教师 " + teacherId);

int row = teacherInfoService.isDelTeacherInfo(teacherId);

return “redirect:/teachers”;

学生管理控制层:

@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/student/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 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/student/studentedit”);

StudentInfo student = studentInfoService.getStudentById(studentId);

model.addObject(“student”, student);

List 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/student/studentedit”);

List 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/suc”);

model.addObject(“success”, “密码错误”);

return model;

request.getSession().setAttribute(“loginStudent”, loginStudent);

model.setViewName(“reception/suc”);

model.addObject(“success”, “登录成功”);

return model;

/**

  • 退出登录

  • @param session

  • @return

*/

@RequestMapping(“/exit”)

public String studentClearLogin(HttpSession session) {

StudentInfo studnet = (StudentInfo) session.getAttribute(“loginStudent”);

logger.info(“学生 “+studnet.getStudentName()+”, 编号 “+studnet.getStudentId()+” 退出登录”);

session.removeAttribute(“loginStudent”);

return “redirect:index.jsp”;

/**

  • 学生注册 验证当前账户是否被占用

  • @param studentAccount 注册账户

  • @param response

  • @throws IOException

*/

@RequestMapping(“/validateAccount”)

public void validateRegisterAccount(@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(“t”);

} else {

logger.error(“注册学生账户 “+studentAccount+” 已被注册”);

response.getWriter().print(“f”);

/**

  • 学生注册

  • @param studentName

  • @param studentAccount

  • @param studentPwd

  • @param classId

  • @param response

  • @throws IOException

*/

@RequestMapping(value=“/studentReg”, method=RequestMethod.POST)

public void studentRegister(

@RequestParam(“name”) String studentName,

@RequestParam(“account”) String studentAccount,

@RequestParam(“pwd”) String studentPwd,

@RequestParam(“classId”) Integer classId,

HttpServletResponse response) throws IOException {

ModelAndView model = new ModelAndView();

student.setStudentName(studentName);

student.setStudentAccount(studentAccount);

student.setStudentPwd(studentPwd);

classInfo.setClassId(classId);

student.setClassInfo(classInfo);

logger.info("学生注册 "+student);

int row = studentInfoService.isAddStudent(student);

response.getWriter().print(“t”);

/**

  • 预注册

  • @return

*/

@RequestMapping(“/preStudentReg”)

public ModelAndView preStudentReg() {

ModelAndView model = new ModelAndView();

model.setViewName(“reception/register”);

model.addObject(“classs”, classInfoService.getClasses(null));

return model;

/**

  • 学生进入考试

  • @param classId 班级编号

  • @param examPaperId 试卷编号

  • @param studentId 考生编号

  • @param examTime 考试时间

  • @param beginTime 考试开始时间

  • @param gradeId 系部编号

  • @param session

  • @return

*/

@RequestMapping(“/begin”)

public ModelAndView beginExam(

@RequestParam(“classId”) Integer classId,

@RequestParam(“examPaperId”) Integer examPaperId,

@RequestParam(value=“studentId”, required=false) Integer studentId,

@RequestParam(“examTime”) Integer examTime,

@RequestParam(“beginTime”) String beginTime,

@RequestParam(“gradeId”) Integer gradeId,

HttpSession session) {

ModelAndView model = new ModelAndView();

/*

  • 查询该考试当前进入的试卷是否已经在历史记录中存在

  • 如果存在,则不能再次进入考试; 反之进入考试

*/

Map<String, Object> map = new HashMap<String, Object>();

map.put(“studentId”, studentId);

map.put(“examPaperId”, examPaperId);

int count = examHistoryPaperService.getHistoryInfoWithIds(map);

if(session.getAttribute(“loginStudent”) == null) {

model.addObject(“error”, “请先登录后再操作”);

model.setViewName(“error”);

return model;

} else if (count >= 1) {

model.addObject(“error”, “不能重复考试”);

model.setViewName(“error”);

return model;

} else {

logger.info("学生 “+studentId+” 进入考试 班级 “+classId+” 试卷 "+examPaperId);

model.setViewName(“/reception/exam”);

ExamPaperInfo examPaper = new ExamPaperInfo();

examPaper.setExamPaperId(examPaperId);

esm.setExamPaper(examPaper);

//获取试卷 试题集合

List esms = examSubjectMiddleInfoService.getExamPaperWithSubject(esm);

logger.info("考试试题总量 "+esms.size());

//获取当前考生在当前试卷中已选答案记录

Map<String, Object> choosedMap = new HashMap<String, Object>();

choosedMap.put(“studentId”, studentId);

choosedMap.put(“examPaperId”, examPaperId);

List chooses = examChooseInfoService.getChooseInfoWithSumScore(choosedMap);

if (chooses == null || chooses.size() == 0) {

model.addObject(“chooses”, null);

} else {

model.addObject(“chooses”, chooses);

model.addObject(“esms”, esms);

model.addObject(“sumSubject”, esms.size());

model.addObject(“examPaperId”, examPaperId);

model.addObject(“examTime”, examTime);

model.addObject(“beginTime”, beginTime);

model.addObject(“classId”, classId);

model.addObject(“gradeId”, gradeId);

return model;

/**

  • 获取学生历史考试记录

  • @param studentId 学生编号

  • @return

*/

@RequestMapping(“/history/{studentId}”)

public ModelAndView getExamHistoryInfo(@PathVariable(“studentId”) Integer studentId) {

ModelAndView model = new ModelAndView();

if (studentId == null) {

logger.error(“学生编号 为空”);

model.setViewName(“error”);

return model;

logger.info(“学生 “+studentId+” 获取考试历史记录”);

//获取历史考试信息记录集合

List ehps = examHistoryPaperService.getExamHistoryToStudent(studentId);

model.addObject(“ehps”, ehps);

model.setViewName(“/reception/examHistory”);

return model;

/**

  • 考生提交考试

  • @param studentId

  • @param examPaperId

  • @param classId

  • @param gradeId

  • @return

*/

@RequestMapping(value=“/submit”, method={RequestMethod.POST, RequestMethod.GET})

public String examSubmit(

@RequestParam(“studentId”) Integer studentId,

@RequestParam(“examPaperId”) Integer examPaperId,

@RequestParam(“classId”) Integer classId,

@RequestParam(“gradeId”) Integer gradeId) {

logger.info("学生 “+studentId+” 提交了试卷 "+examPaperId);

//获取当前学生当前试卷所选择的全部答案

Map<String, Object> map = new HashMap<String, Object>();

map.put(“studentId”, studentId);

map.put(“examPaperId”, examPaperId);

List chooses = examChooseInfoService.getChooseInfoWithSumScore(map);

logger.info(“学生 “+studentId+” 共选择了 “+chooses.size()+” 道题”);

//总分记录

int sumScore = 0;

for (ExamChooseInfo choose : chooses) {

SubjectInfo subject = choose.getSubject();

String chooseResult = choose.getChooseResult();

String rightResult = subject.getRightResult();

if (chooseResult.equals(rightResult)) { //答案正确

sumScore += subject.getSubjectScore();

logger.info("学生 “+studentId+” 第 “+subject.getSubjectId()+” 选择正确答案 “+chooseResult+” 当前总分 "+sumScore);

} else {

logger.info("学生 “+studentId+” 第 “+subject.getSubjectId()+” 答案选择错误 “+chooseResult+” 正确答案为 “+rightResult+” 当前总分 "+sumScore);

/*

  • 首先判断当前记录是否已经添加过

  • 防止当前学生点击提交后,系统倒计时再次进行提交

*/

int count = examHistoryPaperService.getHistoryInfoWithIds(map);

if (count == 0) {

//添加到历史记录

map.put(“examScore”, sumScore);

int row = examHistoryPaperService.isAddExamHistory(map);

logger.info(“学生 “+studentId+” 提交的试卷 “+examPaperId+” 已成功处理,并添加到历史记录中”);

return “redirect:willexams?gradeId=”+gradeId+“&classId=”+classId+“&studentId=”+studentId;

/**

  • 学生回顾试卷 – 后台教师查看也调用此方法

  • @param studentId

  • @param examPaperId

  • @param score

  • @param examPaperName

  • @param studentName 后台教师查看需传入学生姓名

  • @return

  • @throws UnsupportedEncodingException

*/

@RequestMapping(“/review”)

public ModelAndView reViewExam(

@RequestParam(“studentId”) Integer studentId,

@RequestParam(“examPaperId”) Integer examPaperId,

@RequestParam(“score”) Integer score,

@RequestParam(“examPaperName”) String examPaperName,

@RequestParam(value=“studentName”, required=false) String studentName) throws UnsupportedEncodingException {

ModelAndView model = new ModelAndView();

if (studentId == null) {

model.addObject(“error”, “请先登录后再操作”);

model.setViewName(“error”);

return model;

} else {

//获取当前试卷的试题集合 – 前台判断需要

examPaper.setExamPaperId(examPaperId);

esm.setExamPaper(examPaper);

List esms = examSubjectMiddleInfoService.getExamPaperWithSubject(esm);

Map<String, Object> map = new HashMap<String, Object>();

map.put(“studentId”, studentId);

map.put(“examPaperId”, examPaperId);

//获取当前回顾试卷 试题、选择答案 信息

List reviews = examChooseInfoService.getChooseInfoWithExamSubject(map);

logger.info("学生 “+studentId+” 回顾试卷 “+examPaperId+” 试题数量 "+reviews.size());

//设置试卷名称、试卷总分

model.addObject(“examPaperName”, examPaperName);

model.addObject(“score”, score);

model.setViewName(“reception/review”);

model.addObject(“views”, reviews);

model.addObject(“esms”, esms);

if (studentName != null) model.addObject(“studentName”, studentName);

model.addObject(“ExamedPaper”, examPaperInfoService.getExamPaper(examPaperId));

return model;

/**

  • 学生查看自己信息

  • @param studentId

  • @return

*/

@RequestMapping(“/self/{studentId}”)

public ModelAndView selfInfo(@PathVariable(“studentId”) Integer studentId) {

StudentInfo stu = studentInfoService.getStudentById(studentId);

ModelAndView model = new ModelAndView();

model.setViewName(“/reception/self”);

model.addObject(“self”, stu);

return model;

/**

  • 学生修改密码

  • @param pwd

  • @param studentId

  • @param response

  • @throws IOException

*/

@RequestMapping(“/reset/{pwd}/{studentId}”)

public void isResetPwd(

@PathVariable(“pwd”) String pwd,

@PathVariable(“studentId”) Integer studentId,

HttpServletResponse response) throws IOException {

logger.info(“学生 “+studentId+” 修改密码”);

student.setStudentId(studentId);

student.setStudentPwd(pwd);

int row = studentInfoService.isResetPwdWithStu(student);

if (row > 0) {

response.getWriter().print(“t”);

} else {

response.getWriter().print(“f”);

科目管理控制层:

@Controller

@SuppressWarnings(“all”)

public class CourseInfoHandler {

@Autowired

private CourseInfoService courseInfoService;

@Autowired

private GradeInfoService gradeInfoService;

private Logger logger = Logger.getLogger(CourseInfoHandler.class);

/**

  • 获取科目信息

  • @param gradeId

  •        系部编号
    
  • @param division

  •        分科情况
    
  • @return

*/

@RequestMapping(“/courses”)

public ModelAndView getCourses(@RequestParam(value = “gradeId”, required = false) Integer gradeId,

@RequestParam(value = “division”, required = false) Integer division) {

ModelAndView model = new ModelAndView();

model.setViewName(“/admin/course/courses”);

CourseInfo course = new CourseInfo();

if (gradeId != null)

course.getGrade().setGradeId(gradeId);

if (division != null)

course.setDivision(division);

List courses = courseInfoService.getCourses(course);

model.addObject(“courses”, courses);

return model;

/**

  • 根据科目编号获取学科信息

  • @param courseId

  •        科目编号
    
  • @return

*/

@RequestMapping(“/course/{courseId}”)

public ModelAndView getCourseById(@PathVariable(“courseId”) Integer courseId) {

ModelAndView model = new ModelAndView();

model.setViewName(“/admin/course/courseedit”);

CourseInfo course = courseInfoService.getCourseById(courseId);

model.addObject(“course”, course);

/** 获取所有系部列表 */

List grades = gradeInfoService.getGrades();

model.addObject(“grades”, grades);

return model;

/**

  • 添加/修改科目信息

  • @param courseId

  •        科目编号
    
  • @param isUpdate

  •        标识是否为修改操作
    
  • @param courseName

  •        科目名称
    
  • @param division

  •        分科情况
    
  • @param gradeId

  •        系部编号
    
  • @return

*/

@RequestMapping(value = “/course/course”, method = RequestMethod.POST)

public String isUpdateOrAddCourse(@RequestParam(value = “courseId”, required = false) Integer courseId,

@RequestParam(value = “isupdate”, required = false) Integer isUpdate,

@RequestParam(“courseName”) String courseName, @RequestParam(“division”) Integer division,

@RequestParam(“gradeId”) Integer gradeId) {

CourseInfo course = new CourseInfo();

course.setCourseId(courseId);

course.setCourseName(courseName);

course.setDivision(division);

GradeInfo grade = new GradeInfo();

grade.setGradeId(gradeId);

course.setGrade(grade);

// 修改

if (isUpdate != null) {

int row = courseInfoService.isUpdateCourse(course);

// 添加

else {

int row = courseInfoService.isAddCourse(course);

return “redirect:/courses”;

/**

  • 删除科目

  • @param courseId

  •        待删除科目编号
    
  • @return

*/

@RequestMapping(value = “/course/{courseId}”, method = RequestMethod.DELETE)

public String isDelTeacher(@PathVariable(“courseId”) Integer courseId) {

int row = courseInfoService.isDelCourse(courseId);

return “redirect:/courses”;

/**

  • 预添加科目信息

  • @return

*/

@RequestMapping(“/preAddCourse”)

public ModelAndView preAddCourse() {

ModelAndView model = new ModelAndView();

model.setViewName(“/admin/course/courseedit”);

/** 获取系部集合 */

List grades = gradeInfoService.getGrades();

model.addObject(“grades”, grades);

return model;


  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
一、项目简介 本项目是一套基于JavaWeb作业提交与批改系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。 包含:项目源码、数据库脚本、软件工具、项目说明等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行! 二、技术实现 ​后台框架:JSP、Servlet、JDBC ​数据库:MySQL 开发环境:JDK、Eclipse、Tomcat 三、系统功能 该作业提交与批改系统采用B/S结构,使用JAVA开发语言,以MySQL作为后台数据库,系统分为前台界面和后台管理。 系统共包含三种角色:管理员、教师、学生,具体功能如下: (1) 班级信息管理模块:在该模块中定义了班级信息的管理,其功能包括班级信息的录入、查询、删除、打印等操作。 (2) 教师信息管理模块:在该模块中定义了教师信息的管理,其功能包括教师信息的录入、查询、删除、打印等操作。 (3) 学生信息管理模块:在该模块中定义了学生信息的管理,其功能包括学生信息的录入、查询、删除、打印等操作。 (4) 公告信息管理模块:在该模块中定义了公告信息的管理,其功能包括公告信息的录入、查询、删除等操作。 (5) 留言信息管理模块:在该模块中定义了留言信息的管理,其功能包括留言信息的查询、删除等操作。 (6) 资料信息管理模块:在该模块中定义了资料信息的管理,其功能包括资料信息的录入、查询、删除等操作。 (7) 系统管理模块:在该模块中定义了管理员信息的管理,其功能包括管理员的查询,增加和删除等功能操作。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。
网选课系统是一个非常实用的系统,可以方便学生进行选课操作,也可以方便教师进行课程管理。下面是一个基于JavaWeb的网上选课系统的设计思路: 1. 系统架构 该系统采用 B/S 架构,即浏览器/服务器架构。前端使用 HTML、CSS、JavaScript 和 JQuery,后端使用 Java+SSM 框架和 MySQL 数据库。 2. 系统功能 (1)学生模块:学生可以登录系统后进行选课操作,查看已选课程,并对已选课程进行退选操作。 (2)教师模块:教师可以登录系统后进行课程管理操作,包括添加课程、修改课程、删除课程等操作。 (3)管理员模块:管理员可以登录系统后对学生和教师进行管理,包括添加学生、添加教师、修改学生信息、修改教师信息等操作。 (4)公告管理:管理员可以发布公告,学生和教师可以浏览公告。 (5)选课规则管理:管理员可以设置选课规则,例如每个学生最多选择多少门课程,每门课程最多选多少人等。 3. 数据库设计 该系统需要设计以下数据库表: (1)学生表:包括学生编号、学生姓名、学生性别、学生年龄、所在班级等字段。 (2)教师表:包括教师编号、教师姓名、教师性别、所教课程、教龄等字段。 (3)课程表:包括课程编号、课程名称、授课教师、上课时间、选课人数等字段。 (4)选课记录表:包括学生编号、课程编号等字段。 (5)公告表:包括公告编号、公告内容、发布时间等字段。 4. 技术实现 该系统采用 Java+SSM 框架进行实现,其中: (1)后端技术:采用 SpringMVC 框架进行控制器的开发,采用 MyBatis 框架进行数据库操作。 (2)前端技术:采用 HTML、CSS、JavaScript 和 JQuery 进行页面布局和交互效果的实现。 (3)数据库技术:采用 MySQL 数据库进行数据存储和管理。 5. 总结 网上选课系统是一个非常实用的系统,它可以方便学生进行选课操作,也可以方便教师进行课程管理。该系统采用 B/S 架构,采用 Java+SSM 框架进行开发,实现了学生模块、教师模块、管理员模块、公告管理和选课规则管理等功能。在实现时需要注意数据库表的设计和技术实现。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值