——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
管理员:课程、教师、学生模板的增删改查管理
教师:查看授课、成绩、打分等
学生:查看课程、选课、退课等


管理员





学生



教师



技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) Maven MySQL Bootstrap JavaScript
基于javaweb的SSM+Maven教务选课管理系统(管理员、教师、学生)(java+jsp+maven+ssm+mysql+tomcat)
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
@RequestMapping("/showCourse") public String showCourse(Model model, Integer page) throws Exception {
List<CourseCustom> list = null; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(courseService.getCountCouse()); if (page == null || page == 0) { pagingVO.setToPageNo(1); list = courseService.findByPaging(1); } else { pagingVO.setToPageNo(page); list = courseService.findByPaging(page); }
model.addAttribute("courseList", list); model.addAttribute("pagingVO", pagingVO);
return "admin/showCourse";
}
@RequestMapping(value = "/addCourse", method = {RequestMethod.GET}) public String addCourseUI(Model model) throws Exception {
List<TeacherCustom> list = teacherService.findAll(); List<College> collegeList = collegeService.finAll();
model.addAttribute("collegeList", collegeList); model.addAttribute("teacherList", list);
return "admin/addCourse"; }
@RequestMapping(value = "/addCourse", method = {RequestMethod.POST}) public String addCourse(CourseCustom courseCustom, Model model) throws Exception {
Boolean result = courseService.save(courseCustom);
if (!result) { model.addAttribute("message", "课程号重复");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
@RequestMapping(value = "/editStudent", method = {RequestMethod.POST}) public String editStudent(StudentCustom studentCustom) throws Exception {
studentService.updataById(studentCustom.getUserid(), studentCustom);
return "redirect:/admin/showStudent"; }
@RequestMapping(value = "/removeStudent", method = {RequestMethod.GET} ) public String removeStudent(Integer id) throws Exception { if (id == null) { return "admin/showStudent"; } try { studentService.removeById(id); userloginService.removeByName(id.toString()); } catch (Exception e) { e.printStackTrace(); }
return "redirect:/admin/showStudent"; }
@RequestMapping(value = "selectStudent", method = {RequestMethod.POST}) public String selectStudent(String findByName, Model model) throws Exception {
List<StudentCustom> list = studentService.findByName(findByName);
model.addAttribute("studentList", list); return "admin/showStudent"; }
@RequestMapping("/showTeacher") public String showTeacher(Model model, Integer page) throws Exception {
List<TeacherCustom> list = null;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| SelectedCourseCustom selectedCourseCustom = selectedCourseService.findOne(scc);
model.addAttribute("selectedCourse", selectedCourseCustom);
return "teacher/mark"; }
@RequestMapping(value = "/mark", method = {RequestMethod.POST}) public String mark(SelectedCourseCustom scc) throws Exception {
selectedCourseService.updataOne(scc);
return "redirect:/teacher/gradeCourse?id="+scc.getCourseid(); }
@RequestMapping(value = "/passwordRest") public String passwordRest() throws Exception { return "teacher/passwordRest"; }
} package com.demo.common.exception;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| throw new CustomException("未找到该名学生"); } List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list); model.addAttribute("teacher", teacherCustom);
return "admin/editTeacher"; }
@RequestMapping(value = "/editTeacher", method = {RequestMethod.POST}) public String editTeacher(TeacherCustom teacherCustom) throws Exception {
teacherService.updateById(teacherCustom.getUserid(), teacherCustom);
return "redirect:/admin/showTeacher"; }
@RequestMapping("/removeTeacher") public String removeTeacher(Integer id) throws Exception { if (id == null) { return "admin/showTeacher"; } teacherService.removeById(id); userloginService.removeByName(id.toString());
return "redirect:/admin/showTeacher"; }
@RequestMapping(value = "selectTeacher", method = {RequestMethod.POST}) public String selectTeacher(String findByName, Model model) throws Exception {
List<TeacherCustom> list = teacherService.findByName(findByName);
model.addAttribute("teacherList", list); return "admin/showTeacher"; }
@RequestMapping("/showCourse") public String showCourse(Model model, Integer page) throws Exception {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
public class CustomExceptionResolver implements HandlerExceptionResolver {
public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
ModelAndView modelAndView = new ModelAndView();
CustomException customException; if (e instanceof CustomException) { customException = (CustomException)e; } else if (e instanceof UnknownAccountException) { modelAndView.addObject("message", "没有该用户"); modelAndView.setViewName("error"); return modelAndView; } else if (e instanceof IncorrectCredentialsException) { modelAndView.addObject("message", "密码错误"); modelAndView.setViewName("error"); return modelAndView; } else { customException = new CustomException("未知错误"); }
String message = customException.getMessage();
modelAndView.addObject("message", message); modelAndView.setViewName("error");
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| }
@RequestMapping("/removeTeacher") public String removeTeacher(Integer id) throws Exception { if (id == null) { return "admin/showTeacher"; } teacherService.removeById(id); userloginService.removeByName(id.toString());
return "redirect:/admin/showTeacher"; }
@RequestMapping(value = "selectTeacher", method = {RequestMethod.POST}) public String selectTeacher(String findByName, Model model) throws Exception {
List<TeacherCustom> list = teacherService.findByName(findByName);
model.addAttribute("teacherList", list); return "admin/showTeacher"; }
@RequestMapping("/showCourse") public String showCourse(Model model, Integer page) throws Exception {
List<CourseCustom> list = null; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(courseService.getCountCouse()); if (page == null || page == 0) { pagingVO.setToPageNo(1); list = courseService.findByPaging(1); } else { pagingVO.setToPageNo(page); list = courseService.findByPaging(page); }
model.addAttribute("courseList", list); model.addAttribute("pagingVO", pagingVO);
return "admin/showCourse";
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=051521512602104ab
https://javayms.pages.dev?id=051521512602104ab