基于javaweb的SSM+Maven网上选课系统(java+ssm+jsp+mysql+maven)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

030023012402

040023012402

060023012402

070023012402

080023012402

基于javaweb的SSM+Maven网上选课系统(java+ssm+jsp+mysql+maven)

一、项目简述

功能: 系统分为三个角色。最高权限管理员,学生,教师,包括 学生管理,教师管理,课程管理,选课,退课,成绩查 询。,教学课程,查看选课名单等等功能完全齐备。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + Mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + Bootstrap4+ css + JavaScript + JQuery + Ajax + particles.js+ maven等等。

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
	@RequestMapping(value = "/exitsel/{cid}/{sid}", method = RequestMethod.GET)
public ModelAndView exitSel(@PathVariable("cid") String cid, @PathVariable("sid") String sid) {

if (selectCourseService.deleteSC(cid, sid) != 0) {
return new ModelAndView(new RedirectView("/StudentInfo/StudentHandler/exitchoose/{sid}/1"));
} else {
return new ModelAndView(new RedirectView("../fail.jsp"));
}

}

// 学生查询本人选课
@RequestMapping(value = "/endcourse/{sid}/{pn}", method = RequestMethod.GET)
public String endcourse(@PathVariable("sid") String sid, Grade grade, HttpServletRequest request,
@PathVariable(value = "pn") String pn, Model model) {

List<Grade> endCourseList = new ArrayList<Grade>();
endCourseList = gradeService.getEedCourseBySid(1, 10, sid);
pageIn(model, endCourseList);
request.setAttribute("endCourseList", endCourseList);

return "student/endCourse";

}

}
package net.fuzui.StudentInfo.handler;




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
		return "student/noseling";
}

}

// 加入课程
@RequestMapping("/seling")
public String confirmSelect(@RequestParam("cid") String cid, @RequestParam("sid") String sid, Model model,
HttpSession httpSession, HttpServletRequest httpRequest) {
// 判断是否加入过此课程
if (selectCourseService.existCourse(cid, sid) != null) {
httpRequest.setAttribute("msg", "已经加入过该课程,不能重复加入!");
System.out.println("已经加入过该课程,不能重复加入!");
return "fail";
}
if (selectCourseService.selectCourse(cid, sid) != 0) {
System.out.println(cid);
System.out.println(sid);
return "success";
} else {
return "fail";
}

}

// 退出
@RequestMapping("/backseling/{cid}")
public ModelAndView backConfirmSelect(@PathVariable(value = "cid") String cid) {

return new ModelAndView(new RedirectView("/StudentInfo/StudentHandler/selqueryy/1"));

}

// 跳转页面
@RequestMapping("/selqueryy/{pn}")
public String selQueryy(HttpServletRequest request, @PathVariable(value = "pn") String pn, Model model) {
int no = Integer.parseInt(pn);
List<Course> courseList = new ArrayList<Course>();
PageHelper.startPage(no, 5);
courseList = courseService.selectCourseBySql(1, 10);
pageIn(model, courseList);
request.setAttribute("courseList", courseList);
return "student/selCourse";
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
}


// 结课成绩查询页
@RequestMapping(value = "/endcougrade/{cid}/{cname}/{pn}", method = RequestMethod.GET)
public String endCourseGrade(@PathVariable("cid") String cid, @PathVariable("cname") String cname, Model model,
HttpSession httpSession, @PathVariable(value = "pn") String pn, HttpServletRequest request) {

int no = Integer.parseInt(pn);
PageHelper.startPage(no, 5);
List<CourseGrade> lookList = new ArrayList<CourseGrade>();
lookList = coursePlanService.getCourseGrade(1, 10, cid);
pageIn(model, lookList);
httpSession.setAttribute("lookList1", lookList);

request.setAttribute("cname", cname);

return "teacher/endCourseGrade";

}

// 添加成绩
@RequestMapping(value = "/addGrade", method = RequestMethod.POST)
public String addGrade(@RequestParam("cid") String cid, @RequestParam("sid") String sid,
@RequestParam("grade") Integer grade, Model model, HttpServletRequest request) {


Grade g = new Grade();
g.setCid(cid);
g.setSid(sid);
g.setGrade(grade);

/**
* 根据cid查学分
*/
if(grade >= 60) {
Integer credits = coursePlanService.getCreditsByCid(cid);
g.setCredits(credits);
}

gradeService.insertGrade(g);

System.out.println(g.toString());
return "teacher/endCourse";

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

return new ModelAndView(new RedirectView("/StudentInfo/index.jsp"));
}
}
package net.fuzui.StudentInfo.handler;





/**
*
*/
@Controller
@RequestMapping("/AjaxHandler")
public class AjaxHandler {
@Autowired
CourseService courseService;
@Autowired
StudentService studentService;
@Autowired
TeacherService teacherService;
@Autowired
CoursePlanService coursePlanService;

/**
* ajax验证课程编号是否存在
* @param cid
* @param response
* @param request
* @throws IOException
*/
@RequestMapping(value="/existCid",method = RequestMethod.POST)
public void existCid(@RequestParam("cid") String cid,HttpServletResponse response,HttpServletRequest request) throws IOException{
System.out.println("课程编号="+cid);

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
 	public ModelAndView loginTeacher(@RequestParam("tid") String tid, @RequestParam("tpassword") String tpassword,
Model model, HttpSession httpSession) {

if (teacherService.queryByNamePwd(tid, tpassword) != null) {

Teacher teacher = new Teacher();
teacher = teacherService.getByTeaTid(tid);
// model.addAttribute("tid", tid);
httpSession.setAttribute("tid", tid);
httpSession.setAttribute("tname", teacher.getTname());
// httpSession.setAttribute("teachername", teacher.getTname());
return new ModelAndView(new RedirectView("../teacher/teacherFace.jsp"));

} else {
return new ModelAndView(new RedirectView("../fail.jsp"));
}

}

// 教师退出登录
@RequestMapping("/teacherlogout")
public ModelAndView teacherLogout(HttpSession httpSession) {

httpSession.removeAttribute("tid");
httpSession.removeAttribute("tname");
httpSession.removeAttribute("couList");
httpSession.removeAttribute("sesList");
httpSession.removeAttribute("lookList");

return new ModelAndView(new RedirectView("/StudentInfo/index.jsp"));
}
}
package net.fuzui.StudentInfo.handler;




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
		httpSession.setAttribute("coursePlanList", coursePlanList);
httpSession.setAttribute("couList", couList);

System.out.println(coursePlanList);

System.out.println(couList);
}
return "teacher/manageCourse";
}

// 修改
@RequestMapping("/moditypw/{tid}")
public ModelAndView teacherModi(@PathVariable(value = "tid") String tid, Model model, HttpServletRequest request) {
System.out.print(request.getRemoteAddr());
return new ModelAndView(new RedirectView("../../teacher/modityPw.jsp"));
}

@RequestMapping("/moditypassword/{tid}")
public ModelAndView teacherModiPw(@PathVariable(value = "tid") String tid,
@RequestParam("tpassword") String tpassword, Model model) {
if (teacherService.modifyTeacherPwd(tpassword, tid) != 0) {
return new ModelAndView(new RedirectView("../queryvita/{tid}"));
} else {
return new ModelAndView(new RedirectView("../fail.jsp"));
}

}

@RequestMapping(value = "/sercsc/{tid}/{pn}", method = RequestMethod.GET)
public String sercChoose(@PathVariable("tid") String tid, StuSelectResult ssr, Model model, HttpSession httpSession,
@PathVariable(value = "pn") String pn) {

int no = Integer.parseInt(pn);
PageHelper.startPage(no, 5);

List<StuExitSelect> sesList = new ArrayList<StuExitSelect>();
sesList = selectCourseService.getLookByTid(1, 10, tid);
pageIn(model, sesList);
httpSession.setAttribute("sesList", sesList);

return "teacher/serchSC";

}

// 查询
@RequestMapping(value = "/looksel/{cid}/{cname}/{pn}", method = RequestMethod.GET)


项目链接:
https://javayms.github.io?id=391422292105200fk
https://javayms.pages.dev?id=391422292105200fk