学生成绩管理系统(SSM+MySQL+JSP)

您所在的位置:网站首页 学生成绩管理系统的特点 学生成绩管理系统(SSM+MySQL+JSP)

学生成绩管理系统(SSM+MySQL+JSP)

2023-10-15 05:03| 来源: 网络整理| 查看: 265

开发工具:Eclipse前端技术:基础:html+css+JavaScript框架:JQuery+H-ui后端技术:Spring+SpringMVC+mybatis模板引擎:JSP数据库:mysql 5.7.27jdk版本:1.8.0_251tomcat版本:Tomcat 9.0数据库连接池:druid

一、功能概述

学生管理系统的用户包括学生、教师及管理员。(1)学生可以对个人的各科成绩进行查询、个人信息修改、选课、修改登录密码等操作。(2)教师可以对学生信息、教师个人信息、课程信息、成绩等进行管理,实现对这些信息的查询、录入、添加、修改、删除等操作。(3)管理员可以对学生、教师、课程、成绩信息进行管理,实现对这些信息的查询、录入、添加、修改、删除以及权限管理等操作。功能结构图:在这里插入图片描述

二、数据库表结构

成绩表(Score):在这里插入图片描述学生表(student):在这里插入图片描述课程表(subject):在这里插入图片描述教师表(teacher):在这里插入图片描述用户表(user):在这里插入图片描述

三、项目结构

在这里插入图片描述

四、配置SSM文件

Spring-context.xml

Spring Configuration

 

Mybatis-config.xml:

DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> spring-mvc.xml: Spring MVC Configuration 五、配置web.xml和demo.properties stusystem_3 contextConfigLocation classpath*:/spring-context*.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /* springServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath*:/spring-mvc*.xml 1 springServlet / DruidStatView com.alibaba.druid.support.http.StatViewServlet allow 127.0.0.1 DruidStatView /druid/* 600 default /js/* /css/* /images/* /font/* /assets/* /lib/*

demo.properties

#============================# #===== Database settings ====# #============================# #mysql database setting jdbc.type=mysql jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/stusystem?useUnicode=true&characterEncoding=utf-8 jdbc.username=root jdbc.password=123456 #pool settings jdbc.pool.init=1 jdbc.pool.minIdle=3 jdbc.pool.maxActive=20 #jdbc.testSql=SELECT 'x' jdbc.testSql=SELECT 'x' FROM DUAL web.view.prefix=/ web.view.suffix=.jsp web.view.index=/StuSystem/user/login 六、各个模块代码 UserBean.java: package com.stusystem.entity; import org.apache.ibatis.type.Alias; import org.springframework.stereotype.Component; @Alias("userbean") @Component public class Userbean { private String userName; private int userId; private String admin; private String password; private String xmm; public String getXmm() { return xmm; } public void setXmm(String xmm) { this.xmm = xmm; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getAdmin() { return admin; } public void setAdmin(String admin) { this.admin = admin; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } UserDao.java: package com.stusystem.dao; import com.stusystem.entity.Userbean; public interface UserDao { //验证登录信息 public Userbean getUsrInfoByNameAndPsw(Userbean userbean); //修改密码 public void mmxg(Userbean userbean); } UserDao.xml select * from user where user_id=#{userId} and password=#{password} and admin=#{admin} UPDATE user SET password = #{xmm} WHERE (user_id=#{userId}) UserController.java: package com.stusystem.controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.stusystem.dao.UserDao; import com.stusystem.entity.Userbean; @Controller @RequestMapping(value = "user") public class UserController { @Autowired private UserDao userDao; // ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-context.xml"); // UserDao userDao = (UserDao) applicationContext.getBean("userDao"); //返回登陆界面 //验证用户的用户名和密码是有和数据库中的匹配 @RequestMapping(value = {"/login"}) public String userlogin() { return "login"; } //登陆验证 @RequestMapping(value = {"/loginyanzheng"}) public void loginyanzheng(Userbean userbean,HttpServletResponse response,HttpServletRequest request) throws IOException { Userbean user = userDao.getUsrInfoByNameAndPsw(userbean); if(user==null){ response.getWriter().println("{\"status\":0,\"msg\":\"用户名或密码有误!\"}"); }else{ // 用户的信息存放到session中。 HttpSession session = request.getSession(); session.setAttribute("userbean", user); response.getWriter().println("{\"status\":1,\"url\":\"index\"}"); } } //返回系统主界面 @RequestMapping(value = {"/index"}) public String index() { return "index"; } //返回关于页面 @RequestMapping(value = {"/gy"}) public String guanyu() { return "gy"; } //返回密码修改页面 @RequestMapping(value = {"/dlmmxg"}) public String dlmmxg() { return "dlmmxg"; } //修改登录密码 @RequestMapping(value = {"/mmxg"}) public String mmxg(Userbean userbean,HttpServletResponse response,HttpServletRequest request){ Userbean user = userDao.getUsrInfoByNameAndPsw(userbean); if(user==null){ request.setAttribute("status", '0'); }else{ userDao.mmxg(userbean); request.setAttribute("status", '1'); } return "dlmmxg"; } //退出系统 @RequestMapping(value = {"/loginout"}) public String loginout(HttpServletRequest request){ HttpSession session = request.getSession(); session.invalidate(); return "login"; } } login.jsp DOCTYPE html> 学生成绩管理系统|登录 function login() { var userid = document.getElementById("userid").value; var password = document.getElementById("password").value; var list = document.getElementsByName("inlineRadioOptions"); var admin = null; if(!list[0].checked&&!list[1].checked&&!list[2].checked){ return; } for(var i = 0 ; i DOCTYPE HTML> 学生成绩管理系统|首页 var index = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2 学生成绩管理系统 欢迎您,${userbean.userName} (管理员) (教师) (学生) [退出] 首页 //学生登录 if('${userbean.admin}'=='3'){ BUI.use('common/main',function(){ var config = [{ id:'menu', homePage:'gy', menu:[{ text:'学生操作', items:[ {id:'cjcx',text:'成绩查询',href:'/StuSystem_3/score/xsgrcjcx?studentId=' + '${userbean.userId}'}, {id:'xsgrkcgl',text:'学生个人课程管理',href:'/StuSystem_3/score/scoreone?page=1&studentId=' + '${userbean.userId}' }, {id:'xsgrxxgl',text:'学生个人信息管理',href:'/StuSystem_3/student/studentone?stuId=' + '${userbean.userId}' }, {id:'dlmmxg',text:'登录密码修改',href:'/StuSystem_3/user/dlmmxg'}, {id:'gy',text:'关于',href:'gy'} ] }] }]; new PageUtil.MainPage({ modulesConfig : config }); }); } //教师登录 if('${userbean.admin}'=='2'){ BUI.use('common/main',function(){ var config = [{ id:'menu', homePage:'gy', menu:[{ text:'教师操作', items:[ {id:'xsxxgl',text:'学生信息管理',href:'/StuSystem_3/teacher/teacherlist?page=1'}, {id:'kcxxgl',text:'课程信息管理',href:'/StuSystem_3/student/studentlist?page=1'}, {id:'jsgrxxgl',text:'教师个人信息管理',href:'/StuSystem_3/teacher/teacherone?teacherId='+'${userbean.userId}'}, {id:'xscjgl',text:'学生成绩管理',href:'/StuSystem_3/score/scorelist?page=1'}, {id:'dlmmxg',text:'登录密码修改',href:'/StuSystem_3/user/dlmmxg'}, {id:'gy',text:'关于',href:'gy'} ] }] }]; new PageUtil.MainPage({ modulesConfig : config }); }); } //管理员登录 if('${userbean.admin}'=='1'){ BUI.use('common/main',function(){ var config = [{ id:'menu', homePage:'gy', menu:[{ text:'管理员操作', items:[ {id:'jsxxgl',text:'教师信息管理',href:'/StuSystem_3/teacher/teacherlist?page=1'}, {id:'xsxxgl',text:'学生信息管理',href:'/StuSystem_3/student/studentlist?page=1'}, {id:'kcxxgl',text:'课程信息管理',href:'/StuSystem_3/subject/subjectlist?page=1'}, {id:'xscjgl',text:'学生成绩管理',href:'/StuSystem_3/score/scorelist?page=1'}, {id:'dlmmxg',text:'登录密码修改',href:'/StuSystem_3/user/dlmmxg'}, {id:'gy',text:'关于',href:'gy'} ] }] }]; new PageUtil.MainPage({ modulesConfig : config }); }); } dlmmxg.jsp DOCTYPE HTML> $(function(){ $("#demoform-2").Validform({ tiptype:2, usePlugin:{ datepicker:{},//日期控件校验; passwordstrength:{ minLen:6,//设置密码长度最小值,默认为0; maxLen:18,//设置密码长度最大值,默认为30; trigger:function(obj,error){ //该表单元素的keyup和blur事件会触发该函数的执行; //obj:当前表单元素jquery对象; //error:所设密码是否符合验证要求,验证不能通过error为true,验证通过则为false; //console.log(error); if(error){ obj.parent().find(".Validform_checktip").show(); obj.parent().find(".passwordStrength").hide(); }else{ obj.parent().find(".passwordStrength").show(); } } } } }); }); 教师信息编辑页面 旧密码: 新密码: 密码验证: if("${status}" == '1'){ swal({title:"密码修改成功!",text:"您已经向服务器了这条信息!",type:"success"}, function () { location.href = "dlmmxg"; }); }else if("${status}" == '0'){ swal("哦豁","修改失败失败,请确保密码输入正确!","error"); }else{} (2)学生模块 StudentBean.java: package com.stusystem.entity; public class StudentBean { private int stuId; private String stuName; private String stuSex; private String stuSystem; private String stuClass; private String stuPhone; private int page; public int getPage() { return (page-1)*6; } public void setPage(int page) { this.page = page; } public int getStuId() { return stuId; } public void setStuId(int stuId) { this.stuId = stuId; } public String getStuName() { return stuName; } public void setStuName(String stuName) { this.stuName = stuName; } public String getStuSex() { return stuSex; } public void setStuSex(String stuSex) { this.stuSex = stuSex; } public String getStuSystem() { return stuSystem; } public void setStuSystem(String stuSystem) { this.stuSystem = stuSystem; } public String getStuClass() { return stuClass; } public void setStuClass(String stuClass) { this.stuClass = stuClass; } public String getStuPhone() { return stuPhone; } public void setStuPhone(String stuPhone) { this.stuPhone = stuPhone; } } StudentDao.java: package com.stusystem.dao; import java.util.List; import com.stusystem.entity.StudentBean; public interface StudentDao { public List getStudent(StudentBean studentbean) throws Exception;//返回学生信息的list public int getstupage(StudentBean studentbean) throws Exception;//分页处理 public StudentBean getStudentone (StudentBean studentbean) throws Exception;//返回一条学生信息 public void studentdel(StudentBean studentbean) throws Exception;//删除一条学生信息 public void studentadd(StudentBean studentbean) throws Exception;//增加一条学生信息 public void studentxiugai(StudentBean studentbean) throws Exception;//修改一条学生信息 } StudentDao.xml: ```java DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> SELECT * FROM student where stu_name = #{stuName} limit #{page} , 6 SELECT * FROM student limit #{page} , 6 select count(*) from student where stu_name = #{stuName} select count(*) from student SELECT * FROM student WHERE stu_id=#{stuId} DELETE FROM student WHERE (stu_id=#{stuId}) UPDATE student SET stu_name=#{stuName}, stu_sex=#{stuSex}, stu_system=#{stuSystem}, stu_phone=#{stuPhone}, stu_class=#{stuClass} WHERE (stu_id=#{stuId}) INSERT INTO student (stu_name, stu_sex, stu_system, stu_phone, stu_class) VALUES (#{stuName},#{stuSex},#{stuSystem},#{stuPhone},#{stuClass}) StudentController.java package com.stusystem.controller; import java.io.IOException; import java.net.URLDecoder; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.stusystem.dao.StudentDao; import com.stusystem.entity.StudentBean; @Controller @RequestMapping(value = "student") public class StudentController { @Autowired private StudentDao studentDao; // ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-context.xml"); // StudentDao studentDao = (StudentDao) applicationContext.getBean("studentDao"); //得到学生列表和页数.返回到学生信息页面 @RequestMapping(value = {"/studentlist"}) public String getStudent(StudentBean stu,Model model) throws Exception{ if(stu.getStuName()!=null&&stu.getStuName()!=""){ stu.setStuName(URLDecoder.decode(stu.getStuName(), "UTF-8")); } List stulist = studentDao.getStudent(stu); int stupage = studentDao.getstupage(stu); model.addAttribute("studentlist", stulist); model.addAttribute("stupage", stupage); model.addAttribute("studentname", stu.getStuName()); return "studentlist"; } //得到一个学生信息。返回到一个学生信息页面 @RequestMapping(value = {"/studentone"}) public String getStudentone(StudentBean stu,Model model) throws Exception { StudentBean studentone = studentDao.getStudentone(stu); model.addAttribute("stuone", studentone); return "studentone"; } //得到一个学生信息。返回到学生编辑页面 @RequestMapping(value = {"/studenteditor"}) public String studenteditor(StudentBean stu,Model model) throws Exception { if(stu.getStuId()==0){ return "studenteditor"; }else{ StudentBean studentone = studentDao.getStudentone(stu); model.addAttribute("studentone", studentone); return "studenteditor"; } } //删除学生信息 @RequestMapping(value = {"/studentdel"}) public void studentdel(StudentBean stu,HttpServletResponse response) throws IOException { int a = 0; try { studentDao.studentdel(stu); } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } //添加/修改 ( 以是否有stuId来判断) 学生信息 @RequestMapping(value = {"/studentadd"}) public void studentadd(StudentBean stu,HttpServletResponse response) throws IOException{ int a = 0; try { if(stu.getStuId()==0){ stu.setStuName(URLDecoder.decode(stu.getStuName(), "UTF-8")); stu.setStuSystem(URLDecoder.decode(stu.getStuSystem(), "UTF-8")); stu.setStuSex(URLDecoder.decode(stu.getStuSex(), "UTF-8")); stu.setStuClass(URLDecoder.decode(stu.getStuClass(), "UTF-8")); studentDao.studentadd(stu); }else{ stu.setStuName(URLDecoder.decode(stu.getStuName(), "UTF-8")); stu.setStuSystem(URLDecoder.decode(stu.getStuSystem(), "UTF-8")); stu.setStuSex(URLDecoder.decode(stu.getStuSex(), "UTF-8")); stu.setStuClass(URLDecoder.decode(stu.getStuClass(), "UTF-8")); studentDao.studentxiugai(stu); } } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } } studentlist.jsp DOCTYPE HTML> function del(studentid) { swal({ title: "您确定要删除这条信息吗", text: "删除后将无法恢复,请谨慎操作!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", closeOnConfirm: false }, function () { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status== 1){ swal({title:"删除成功!",text:"您已经永久删除了这条信息!",type:"success"}, function () { var b = '${stupage}' ; b = Math.ceil(b/6) ; location.href = "studentlist?page=" + b; }); }else{ swal("哦豁","删除失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","studentdel?stuId="+studentid,true); xmlhttp.send(); }); } 学生列表 学生信息管理表 Go! 添加+ 学号 学生姓名 学生性别 所在系 班级 电话号码 操作 ${stu.stuId} ${stu.stuName} ${stu.stuSex} ${stu.stuSystem} ${stu.stuClass} ${stu.stuPhone} ;编辑;;;删除 laypage({ cont: 'page11', pages: Math.ceil("${stupage}"/6), //可以叫服务端把总页数放在某一个隐藏域,再获取。假设我们获取到的是18 length skip: true, //是否开启跳页 skin: '#6699FF', curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取 var page = location.search.match(/page=(\d+)/); return page ? page[1] : 1; }(), jump: function(e, first){ //触发分页后的回调 if(!first){ //一定要加此判断,否则初始时会无限刷新 var studengtname = document.getElementById("sousuo").value; location.href = '?page='+e.curr + '&stuName=' + encodeURI(encodeURI(studengtname)); } } }); function bianji(studentId) { layer.open({ type: 2, title: '学生信息编辑页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId='+ studentId }); } function tianjia() { layer.open({ type: 2, title: '学生信息添加页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId=0' }); } function sousuo() { var studentname = document.getElementById("sousuo").value; location.href = 'studentlist?stuName='+ encodeURI(encodeURI(studentname)) + '&page=1' ; } studentone.jsp DOCTYPE HTML> 学生信息列表 学生个人信息管理表 学号 学生姓名 学生性别 所在系 班级 电话号码 操作 ${stuone.stuId} ${stuone.stuName} ${stuone.stuSex} ${stuone.stuSystem} ${stuone.stuClass} ${stuone.stuPhone}  ;编辑 function xiugai() { layer.open({ type: 2, title: '学生个人信息修改页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId='+"${stuone.stuId}" }); } studenteditor.jsp DOCTYPE HTML> $(function(){ $("#demoform-2").Validform({ tiptype:2, usePlugin:{ datepicker:{},//日期控件校验; passwordstrength:{ minLen:6,//设置密码长度最小值,默认为0; maxLen:18,//设置密码长度最大值,默认为30; trigger:function(obj,error){ //该表单元素的keyup和blur事件会触发该函数的执行; //obj:当前表单元素jquery对象; //error:所设密码是否符合验证要求,验证不能通过error为true,验证通过则为false; //console.log(error); if(error){ obj.parent().find(".Validform_checktip").show(); obj.parent().find(".passwordStrength").hide(); }else{ obj.parent().find(".passwordStrength").show(); } } } } }); }); 教师信息编辑页面 姓名: 所在系: 电话号码: 班级: 学生性别: 男 女 if('${studentone.stuSex}' =="女"){ document.getElementById('sex-2').checked="checked"; }else if('${studentone.stuSex}' =="男") { document.getElementById('sex-1').checked="checked"; }else{ } function hehe() { var studentname = document.getElementById("studentname").value; var studentsystem = document.getElementById("studentsystem").value; var studentid = document.getElementById("studentid").value; if(studentid==""){ studentid = 0; } var studentphone = document.getElementById("studentphone").value; var studentclass = document.getElementById("studentclass").value; var list = document.getElementsByName("studentsex"); var studentsex = null; for(var i = 0 ; i DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> SELECT * FROM teacher where teacher_name = #{teacherName} limit #{page} , 6 SELECT * FROM teacher limit #{page} , 6 select count(*) from `teacher` where teacher_name = #{teacherName} select count(*) from `teacher` SELECT * FROM teacher WHERE teacher_id=#{teacherId} DELETE FROM `teacher` WHERE (`teacher_id`=#{teacherId}) UPDATE teacher SET teacher_name=#{teacherName}, teacher_sex=#{teacherSex}, teacher_system=#{teacherSystem}, teacher_phone=#{teacherPhone}, teacher_email=#{teacherEmail} WHERE (teacher_id=#{teacherId}) INSERT INTO `teacher` (`teacher_name`, `teacher_sex`, `teacher_system`, `teacher_phone`, `teacher_email`) VALUES (#{teacherName},#{teacherSex},#{teacherSystem},#{teacherPhone},#{teacherEmail}) TeacherController,java package com.stusystem.controller; import java.io.IOException; import java.net.URLDecoder; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.stusystem.dao.TeacherDao; import com.stusystem.entity.TeacherBean; @Controller @RequestMapping("teacher") public class TeacherController { @Autowired TeacherDao teacherDao; @RequestMapping("/teacherlist") public String getTeacher(TeacherBean tea,Model model,HttpServletRequest request) throws Exception{ if(tea.getTeacherName()!=null&&tea.getTeacherName()!=""){ tea.setTeacherName(URLDecoder.decode(tea.getTeacherName(), "UTF-8")); } List teacherlist=teacherDao.getTeacher(tea); int teapage=teacherDao.getteapage(tea); model.addAttribute("teacherlist",teacherlist); model.addAttribute("teapage",teapage); model.addAttribute("teachername",tea.getTeacherName()); return "teacherlist"; } @RequestMapping("/teacherone") public String getTeacherone(TeacherBean tea,Model model) throws Exception{ TeacherBean teacherone=teacherDao.getTeacherone(tea); model.addAttribute("teaone",teacherone); return "teacherone"; } @RequestMapping("/teachereditor") public String teachereditor(TeacherBean tea,Model model) throws Exception{ if(tea.getTeacherId()==0) { return "teachereditor"; }else { TeacherBean teacherone=teacherDao.getTeacherone(tea); model.addAttribute("teacherone",teacherone); return "teachereditor"; } } @RequestMapping("/teacherdel") public void teacherdel(TeacherBean tea,HttpServletResponse response) throws IOException{ int a = 0; try { teacherDao.teacherdel(tea); } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } //添加一条教师用户信息 @RequestMapping(value = {"/teacheradd"}) public void teacheradd(TeacherBean tea,HttpServletResponse response) throws IOException{ int a = 0; try { if(tea.getTeacherId()==0){ tea.setTeacherName(URLDecoder.decode(tea.getTeacherName(), "UTF-8")); tea.setTeacherSystem(URLDecoder.decode(tea.getTeacherSystem(), "UTF-8")); tea.setTeacherSex(URLDecoder.decode(tea.getTeacherSex(), "UTF-8")); tea.setTeacherEmail(URLDecoder.decode(tea.getTeacherEmail(), "UTF-8")); teacherDao.teacheradd(tea); }else{ tea.setTeacherName(URLDecoder.decode(tea.getTeacherName(), "UTF-8")); tea.setTeacherSystem(URLDecoder.decode(tea.getTeacherSystem(), "UTF-8")); tea.setTeacherSex(URLDecoder.decode(tea.getTeacherSex(), "UTF-8")); tea.setTeacherEmail(URLDecoder.decode(tea.getTeacherEmail(), "UTF-8")); teacherDao.teacherxiugai(tea); } } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } } teacherlist.jsp DOCTYPE HTML> function del(teacherid) { swal({ title: "您确定要删除这条信息吗", text: "删除后将无法恢复,请谨慎操作!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", closeOnConfirm: false }, function () { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status== 1){ swal({title:"删除成功!",text:"您已经永久删除了这条信息!",type:"success"}, function () { var b = '${teapage}' ; b = Math.ceil(b/6) ; location.href = "teacherlist?page="+b; }); }else{ swal("哦豁","删除失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","teacherdel?teacherId="+teacherid,true); xmlhttp.send(); }); } 教师列表 教师信息管理表 Go! 添加+ 教师编号 教师姓名 教师性别 所在系 电话号码 邮箱 操作 ${tea.teacherId} ${tea.teacherName} ${tea.teacherSex} ${tea.teacherSystem} ${tea.teacherPhone} ${tea.teacherEmail} ;编辑;;;删除 laypage({ cont: 'page11', pages: Math.ceil("${teapage}"/6), //可以叫服务端把总页数放在某一个隐藏域,再获取。假设我们获取到的是18 skip: true, //是否开启跳页 skin: '#6699FF', curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取 var page = location.search.match(/page=(\d+)/); return page ? page[1] : 1; }(), jump: function(e, first){ //触发分页后的回调 if(!first){ //一定要加此判断,否则初始时会无限刷新 var teachername = document.getElementById("sousuo").value; location.href = '?page='+e.curr + '&teacherName=' + encodeURI(encodeURI(teachername)); } } }); function bianji(teacherId) { layer.open({ type: 2, title: '教师信息编辑页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'teachereditor?teacherId='+ teacherId }); } function tianjia() { layer.open({ type: 2, title: '教师信息编辑页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'teachereditor?teacherId=0' }); } function sousuo() { var teachername = document.getElementById("sousuo").value; location.href = 'teacherlist?teacherName='+ encodeURI(encodeURI(teachername)) + '&page=1' ; } teacherone.jsp DOCTYPE HTML> 教师信息列表 教师个人信息管理表 教师编号 教师姓名 教师性别 系别 电话号码 邮箱 操作 ${teaone.teacherId} ${teaone.teacherName} ${teaone.teacherSex} ${teaone.teacherSystem} ${teaone.teacherPhone} ${teaone.teacherEmail}  ;编辑 function xiugai() { layer.open({ type: 2, title: '学生个人信息修改页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'teachereditor?teacherId='+"${teaone.teacherId}" }); } teachereditor.jsp DOCTYPE HTML> $(function(){ $("#demoform-2").Validform({ tiptype:2, usePlugin:{ datepicker:{},//日期控件校验; passwordstrength:{ minLen:6,//设置密码长度最小值,默认为0; maxLen:18,//设置密码长度最大值,默认为30; trigger:function(obj,error){ //该表单元素的keyup和blur事件会触发该函数的执行; //obj:当前表单元素jquery对象; //error:所设密码是否符合验证要求,验证不能通过error为true,验证通过则为false; //console.log(error); if(error){ obj.parent().find(".Validform_checktip").show(); obj.parent().find(".passwordStrength").hide(); }else{ obj.parent().find(".passwordStrength").show(); } } } } }); }); 教师信息编辑页面 姓名: 所在系: 电话号码: 邮箱: 教师性别: 男 女 if('${teacherone.teacherSex}' =="女"){ document.getElementById('sex-2').checked="checked"; }else if('${teacherone.teacherSex}' =="男") { document.getElementById('sex-1').checked="checked"; }else{ } function hehe() { var teachername = document.getElementById("teachername").value; var teachersystem = document.getElementById("teachersystem").value; var teacherid = document.getElementById("teacherid").value; if(teacherid==""){ teacherid = 0; } var teacherphone = document.getElementById("teacherphone").value; var teacheremail = document.getElementById("teacheremail").value; var list = document.getElementsByName("teachersex"); var teachersex = null; for(var i = 0 ; i DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> SELECT * FROM subject where subject_name = #{subjectName} limit #{page} , 6 SELECT * FROM subject limit #{page} , 6 select count(*) from `subject` where subject_name = #{subjectName} select count(*) from `subject` SELECT * FROM subject WHERE subject_id=#{subjectId} DELETE FROM `subject` WHERE (`subject_id`=#{subjectId}) UPDATE subject SET subject_name=#{subjectName}, teacher_name=#{teacherName}, subject_credit=#{subjectCredit} WHERE (subject_id=#{subjectId}) INSERT INTO `subject` (`subject_name`, `teacher_name`, `subject_credit`) VALUES (#{subjectName},#{teacherName},#{subjectCredit}) ScoreController.java package com.stusystem.controller; import java.io.IOException; import java.net.URLDecoder; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.stusystem.dao.SubjectDao; import com.stusystem.entity.SubjectBean; @Controller @RequestMapping("subject") public class SubjectController { @Autowired SubjectDao subjectDao; @RequestMapping("/subjectlist") public String getSubject(SubjectBean sbj,Model model) throws Exception{ if(sbj.getSubjectName()!=null&&sbj.getSubjectName()!=""){ sbj.setSubjectName(URLDecoder.decode(sbj.getSubjectName(), "UTF-8")); } List subjectlist=subjectDao.getSubject(sbj); int sbjpage=subjectDao.getsbjpage(sbj); model.addAttribute("subjectlist",subjectlist); model.addAttribute("sbjpage",sbjpage); model.addAttribute("subjectName", sbj.getSubjectName()); return "subjectlist"; } @RequestMapping("/subjecteditor") public String studenteditor(SubjectBean sbj,Model model) throws Exception { if(sbj.getSubjectId()==0){ return "subjecteditor"; }else{ SubjectBean subjectone = subjectDao.getSubjectone(sbj); model.addAttribute("subjectone", subjectone);//如subjecteditor.jsp中可用subjectone.sybjectId来获取课程号 return "subjecteditor"; } } //删除一条课程信息 @RequestMapping(value = {"/subjectdel"}) public void subjectdel(SubjectBean sbj,HttpServletResponse response) throws IOException { int a = 0; try { subjectDao.subjectdel(sbj); } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } //添加一条课程信息 @RequestMapping(value = {"/subjectadd"}) public void subjectadd(SubjectBean sbj,HttpServletResponse response) throws IOException{ int a = 0; try { if(sbj.getSubjectId()==0){ sbj.setSubjectName(URLDecoder.decode(sbj.getSubjectName(), "UTF-8")); sbj.setTeacherName(URLDecoder.decode(sbj.getTeacherName(), "UTF-8")); subjectDao.subjectadd(sbj); }else{ sbj.setSubjectName(URLDecoder.decode(sbj.getSubjectName(), "UTF-8")); sbj.setTeacherName(URLDecoder.decode(sbj.getTeacherName(), "UTF-8")); subjectDao.subjectxiugai(sbj); } } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); }else{ } } } subjectlist.jsp DOCTYPE HTML> function del(studentid) { swal({ title: "您确定要删除这条信息吗", text: "删除后将无法恢复,请谨慎操作!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", closeOnConfirm: false }, function () { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status== 1){ swal({title:"删除成功!",text:"您已经永久删除了这条信息!",type:"success"}, function () { var b = '${stupage}' ; b = Math.ceil(b/6) ; location.href = "studentlist?page=" + b; }); }else{ swal("哦豁","删除失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","studentdel?stuId="+studentid,true); xmlhttp.send(); }); } 学生列表 学生信息管理表 Go! 添加+ 学号 学生姓名 学生性别 所在系 班级 电话号码 操作 ${stu.stuId} ${stu.stuName} ${stu.stuSex} ${stu.stuSystem} ${stu.stuClass} ${stu.stuPhone} ;编辑;;;删除 laypage({ cont: 'page11', pages: Math.ceil("${stupage}"/6), //可以叫服务端把总页数放在某一个隐藏域,再获取。假设我们获取到的是18 length skip: true, //是否开启跳页 skin: '#6699FF', curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取 var page = location.search.match(/page=(\d+)/); return page ? page[1] : 1; }(), jump: function(e, first){ //触发分页后的回调 if(!first){ //一定要加此判断,否则初始时会无限刷新 var studengtname = document.getElementById("sousuo").value; location.href = '?page='+e.curr + '&stuName=' + encodeURI(encodeURI(studengtname)); } } }); function bianji(studentId) { layer.open({ type: 2, title: '学生信息编辑页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId='+ studentId }); } function tianjia() { layer.open({ type: 2, title: '学生信息添加页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId=0' }); } function sousuo() { var studentname = document.getElementById("sousuo").value; location.href = 'studentlist?stuName='+ encodeURI(encodeURI(studentname)) + '&page=1' ; } subjectone.jsp DOCTYPE HTML> 学生信息列表 学生个人信息管理表 学号 学生姓名 学生性别 所在系 班级 电话号码 操作 ${stuone.stuId} ${stuone.stuName} ${stuone.stuSex} ${stuone.stuSystem} ${stuone.stuClass} ${stuone.stuPhone}  ;编辑 function xiugai() { layer.open({ type: 2, title: '学生个人信息修改页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'studenteditor?stuId='+"${stuone.stuId}" }); } subjecteditoe.jsp DOCTYPE HTML> $(function(){ $("#demoform-2").Validform({ tiptype:2, usePlugin:{ datepicker:{},//日期控件校验; passwordstrength:{ minLen:6,//设置密码长度最小值,默认为0; maxLen:18,//设置密码长度最大值,默认为30; trigger:function(obj,error){ //该表单元素的keyup和blur事件会触发该函数的执行; //obj:当前表单元素jquery对象; //error:所设密码是否符合验证要求,验证不能通过error为true,验证通过则为false; //console.log(error); if(error){ obj.parent().find(".Validform_checktip").show(); obj.parent().find(".passwordStrength").hide(); }else{ obj.parent().find(".passwordStrength").show(); } } } } }); }); 教师信息编辑页面 课程名字: 授课老师: 学分: function hehe() { var subjectid = document.getElementById("subjectid").value; if(subjectid==""){ subjectid = 0; } var subjectname = document.getElementById("subjectname").value; var teachername = document.getElementById("teachername").value; var subjectcredit = document.getElementById("subjectcredit").value; if(subjectname==""||teachername==""||subjectcredit==""){ swal("哦豁","提交失败,请重试!","error"); return; } if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status == 1){ swal({title:"提交成功!",text:"您已经向服务器了这条信息!",type:"success"}, function () { parent.top.topManager.reloadPage(); parent.layer.closeAll(); }); }else{ swal("哦豁","提交失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","subjectadd?subjectId="+encodeURI(encodeURI(subjectid)) + "&subjectName=" + encodeURI(encodeURI(subjectname))+ "&teacherName=" + encodeURI(encodeURI(teachername))+ "&subjectCredit=" + encodeURI(encodeURI(subjectcredit)),true); xmlhttp.send(); } (5)分数和选课模块 ScoreBean.java package com.stusystem.entity; import org.apache.ibatis.type.Alias; import org.springframework.stereotype.Component; @Alias("scoreBean") @Component public class ScoreBean { private int scoreId; private int studentId; private String subjectName; private String studentName; private String score; private int subjectId; private String teacherName; private String subjectCredit; private int page; public int getPage() { return (page-1)*6; } public void setPage(int page) { this.page = page; } public String getSubjectCredit() { return subjectCredit; } public void setSubjectCredit(String subjectCredit) { this.subjectCredit = subjectCredit; } public String getTeacherName() { return teacherName; } public void setTeacherName(String teacherName) { this.teacherName = teacherName; } public int getScoreId() { return scoreId; } public void setScoreId(int scoreId) { this.scoreId = scoreId; } public int getStudentId() { return studentId; } public void setStudentId(int studentId) { this.studentId = studentId; } public String getSubjectName() { return subjectName; } public void setSubjectName(String subjectName) { this.subjectName = subjectName; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public int getSubjectId() { return subjectId; } public void setSubjectId(int subjectId) { this.subjectId = subjectId; } } ScoreDao.java package com.stusystem.dao; import java.util.List; import com.stusystem.entity.ScoreBean; import com.stusystem.entity.StudentBean; import com.stusystem.entity.SubjectBean; public interface ScoreDao { public List getscorelist(StudentBean studentBean) throws Exception; public void scoreadd(ScoreBean score) throws Exception; public List getSubject(ScoreBean score) throws Exception; //已选课程信息的分页处理 public int getsbjpage(ScoreBean score)throws Exception; //添加一个学生的选课信息 public void setsubject(ScoreBean score)throws Exception; //查询一个学生已选课程信息的list public List yxsubjectlist(ScoreBean score) throws Exception; //删除一条已选课程 public void delyxkc(ScoreBean score) throws Exception; //查询一个学生的已选课程成绩和课程信息的list public List getscoreonelist(ScoreBean score)throws Exception; } ScoreDao.xml DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> SELECT score.score, `subject`.subject_name, score.score_id FROM score , `subject` WHERE score.subject_id = `subject`.subject_id AND score.student_id = #{stuId} UPDATE score SET score=#{score} WHERE score_id=#{scoreId} select * from `subject` where subject_name = #{subjectName} and subject_id not in (select subject_id from score where student_id = #{studentId} ) limit #{page} ,6 SELECT * FROM subject where subject_id not in (select subject_id from score where student_id = #{studentId} ) limit #{page} ,6 select count(*) from `subject` where subject_name = #{subjectName} and subject_id not in (select subject_id from score where student_id = #{studentId} ) select count(*) from subject where subject_id not in (select subject_id from score where student_id = #{studentId} ) INSERT INTO `score` (`student_id`, `subject_id`) VALUES (#{studentId},#{subjectId}) SELECT * FROM subject where subject_id in (select subject_id from score where student_id = #{studentId} ) DELETE FROM `score` WHERE `student_id`=#{studentId} and subject_id = #{subjectId} SELECT * FROM score , `subject` WHERE score.subject_id = `subject`.subject_id AND score.student_id = #{studentId} ScoreController.java package com.stusystem.controller; import java.io.IOException; import java.net.URLDecoder; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.stusystem.dao.ScoreDao; import com.stusystem.dao.StudentDao; import com.stusystem.entity.ScoreBean; import com.stusystem.entity.StudentBean; import com.stusystem.entity.SubjectBean; @Controller @RequestMapping(value = "score") public class ScoreController { @Autowired private StudentDao studentDao; //要注入必须要将这个类在spring容器中注册 @Autowired private ScoreDao scoreDao; // ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-context.xml"); // StudentDao studentDao = (StudentDao) applicationContext.getBean("studentDao"); // ScoreDao scoreDao = (ScoreDao) applicationContext.getBean("scoreDao"); //查询出所有学生信息到学生成绩管理页面 @RequestMapping(value = {"/scorelist"}) public String getStudent(StudentBean stu,Model model) throws Exception{ if(stu.getStuName()!=null&&stu.getStuName()!=""){ stu.setStuName(URLDecoder.decode(stu.getStuName(), "UTF-8")); } List stulist = studentDao.getStudent(stu); int stupage = studentDao.getstupage(stu); model.addAttribute("studentlist", stulist); model.addAttribute("stupage", stupage); model.addAttribute("studentname", stu.getStuName()); return "scorelist"; } //查询出一个学生已选课程信息list到该学生成绩编辑页面 @RequestMapping(value = {"/scoreeditor"}) public String scoreeditor(StudentBean stu,Model model) throws Exception{ List scorelist = scoreDao.getscorelist(stu); model.addAttribute("scorelist", scorelist); if(scorelist.size()==0){ model.addAttribute("h1", ";;;;;;;;;;;;;;;;;;;;这位同学还没有选课!!!"); } return "scoreeditor"; } //得到在编辑页面编辑好一个学生的各科成绩的list,循环存入数据库中后,在返回存入结果 @RequestMapping(value = {"/scoreadd"}) public void scoreadd(String scorelist,HttpServletResponse response) throws IOException { int a = 0; String[] scoreStrArray = scorelist.split(","); ScoreBean score = new ScoreBean(); try{ for(int i = 0 ; i < scoreStrArray.length ; i+=2 ){ score.setScore(scoreStrArray[i]); score.setScoreId(Integer.parseInt(scoreStrArray[i+1])); scoreDao.scoreadd(score); } }catch (Exception e){ a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); } } //查询出一个学生的未选课程的信息list @RequestMapping(value = {"/scoreone"}) public String scoreone(ScoreBean scorebean,Model model)throws Exception{ String subjectname =scorebean.getSubjectName(); if (subjectname != null && !"".equals(subjectname)) { subjectname= URLDecoder.decode(subjectname, "UTF-8"); scorebean.setSubjectName(URLDecoder.decode(subjectname, "UTF-8")) ; } List subjectlist = scoreDao.getSubject(scorebean); int sbjpage = scoreDao.getsbjpage(scorebean); model.addAttribute("sbjpage", sbjpage); model.addAttribute("subjectlist", subjectlist); model.addAttribute("subjectname", subjectname); return "scoreone"; } //添加一个学生的选课记录 @RequestMapping(value = {"/xuanke"}) public void xuanke(HttpServletResponse response,ScoreBean scorebean) throws IOException{ int a = 0; try { scoreDao.setsubject(scorebean); } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); } } //返回一个学生的已选课程的list到已选课程编辑页面 @RequestMapping(value = {"/xsyxkc"}) public String xsyxkc(ScoreBean scorebean,Model model) throws Exception{ List yxsubjectlist = scoreDao.yxsubjectlist(scorebean); model.addAttribute("yxsubjectlist", yxsubjectlist); return "xsyxkc"; } //删除一个学生的已选课程 @RequestMapping(value = {"/yxkcdel"}) public void yxkcdel(ScoreBean scorebean,HttpServletResponse response) throws IOException{ int a = 0; try { scoreDao.delyxkc(scorebean); } catch (Exception e) { a=a+1; response.getWriter().println("{'status':'0'}"); e.printStackTrace(); } if(a==0){ response.getWriter().println("{'status':'1'}"); } } //查询出一个学生的已选课程成绩信息和相应成绩 @RequestMapping(value = {"/xsgrcjcx"}) public String xsgrcjcx(ScoreBean scorebean,Model model)throws Exception{ List scoreonelist = scoreDao.getscoreonelist(scorebean); model.addAttribute("scoreonelist", scoreonelist); if(scoreonelist.size()==0){ model.addAttribute("h1", "你还没有选课!!"); } return "xsgrcjcx"; } } scorelist.jsp DOCTYPE HTML> 学生列表 学生成绩管理表 Go! 学号 学生姓名 学生性别 所在系 班级 电话号码 操作 ${stu.stuId} ${stu.stuName} ${stu.stuSex} ${stu.stuSystem} ${stu.stuClass} ${stu.stuPhone} ;编辑该学生成绩 laypage({ cont: 'page11', pages: Math.ceil("${stupage}"/6), //可以叫服务端把总页数放在某一个隐藏域,再获取。假设我们获取到的是18 length skip: true, //是否开启跳页 skin: '#6699FF', curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取 var page = location.search.match(/page=(\d+)/); return page ? page[1] : 1; }(), jump: function(e, first){ //触发分页后的回调 if(!first){ //一定要加此判断,否则初始时会无限刷新 var studengtname = document.getElementById("sousuo").value; location.href = '?page='+e.curr + '&stuName=' + encodeURI(encodeURI(studengtname)); } } }); function bianji(studentid) { layer.open({ type: 2, title: '学生成绩编辑页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'scoreeditor?stuId='+studentid }); } function sousuo() { var studentname = document.getElementById("sousuo").value; location.href = 'scorelist?stuName='+ encodeURI(encodeURI(studentname)) + '&page=1'; } scoreone.jsp DOCTYPE HTML> function xuanze(subjectid,studentid) { swal({ title: "您确定要选择本课程吗?", text: "请选择与本人专业相关的课程!!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "选择", closeOnConfirm: false }, function () { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status== 1){ swal({title:"选择成功!",text:"您已经成功选择了本课程!",type:"success"}, function () { location.href = "scoreone?page=1"+"&studentId="+'${userbean.userId}'; }); }else{ swal("哦豁","选择失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","xuanke?subjectId="+ subjectid + "&studentId=" + studentid ,true); xmlhttp.send(); }); } 课程列表 学生个人课程信息管理表 Go! 查看已选择课程 课程编号 课程名字 授课老师 课程学分 操作 ${sbj.subjectId} ${sbj.subjectName} ${sbj.teacherName} ${sbj.subjectCredit}  ;添加本课程 var aa = Math.ceil("${sbjpage}"/6); laypage({ cont: 'page11', pages: aa, //可以叫服务端把总页数放在某一个隐藏域,再获取。假设我们获取到的是18 length skip: true, //是否开启跳页 skin: '#6699FF', curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取 var page = location.search.match(/page=(\d+)/); return page ? page[1] : 1; }(), jump: function(e, first){ //触发分页后的回调 if(!first){ //一定要加此判断,否则初始时会无限刷新 var subjectname = document.getElementById("sousuo").value; location.href = '?page='+e.curr + '&subjectName=' + encodeURI(encodeURI(subjectname)+'&studentId=' + '${userbean.userId}'); } } }); function sousuo() { var subjectname = document.getElementById("sousuo").value; location.href = 'scoreone?subjectName='+ encodeURI(encodeURI(subjectname)) + '&page=1' + '&studentId=' + '${userbean.userId}' ; } function yxkc() { layer.open({ type: 2, title: '学生已选课程信息页面', shadeClose: true, shade: 0.8, shift: 1, //0-6的动画形式,-1不开启 area: ['800px', '80%'], content: 'xsyxkc?studentId='+"${userbean.userId}" }); } scoreeditor,jsp DOCTYPE HTML> $(function(){ $("#demoform-2").Validform({ tiptype:2, usePlugin:{ datepicker:{},//日期控件校验; passwordstrength:{ minLen:6,//设置密码长度最小值,默认为0; maxLen:18,//设置密码长度最大值,默认为30; trigger:function(obj,error){ //该表单元素的keyup和blur事件会触发该函数的执行; //obj:当前表单元素jquery对象; //error:所设密码是否符合验证要求,验证不能通过error为true,验证通过则为false; //console.log(error); if(error){ obj.parent().find(".Validform_checktip").show(); obj.parent().find(".passwordStrength").hide(); }else{ obj.parent().find(".passwordStrength").show(); } } } } }); }); 学生成绩编辑页面 ${h1} ${sco.subjectName}: var list = document.getElementsByName("scorelist"); if(list.length==0){ $("input").hide(); } function hehe() { var list1 = document.getElementsByName("scorelist"); var list2 = document.getElementsByName("scoreid"); var scorelist = [list1.length]; for(var i = 0 ;i DOCTYPE HTML> 课程列表 学生个人课程信息管理表 课程编号 课程名字 授课老师 课程学分 分数 ${sco.subjectId} ${sco.subjectName} ${sco.teacherName} ${sco.subjectCredit} ${sco.score} ${h1} xsyxkc.jsp DOCTYPE HTML> 已选课程列表 学生已选课程表 课程编号 课程名字 授课老师 课程学分 操作 ${sbj.subjectId} ${sbj.subjectName} ${sbj.teacherName} ${sbj.subjectCredit}  ;删除本课程 function del(subjectid,studentid) { swal({ title: "您确定要删除这条信息吗", text: "删除后将无法恢复,请谨慎操作!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", closeOnConfirm: false }, function () { if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //创建XMLHttpRequest对象 xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ var a = eval("("+xmlhttp.responseText+")"); if(a.status== 1){ swal({title:"删除成功!",text:"您已经永久删除了这条信息!",type:"success"}, function () { location.href = 'xsyxkc?studentId=' + '${userbean.userId}' ; }); }else{ swal("哦豁","删除失败,请重试!","error"); } } } ; //服务器响应时完成相应操作 xmlhttp.open("post","yxkcdel?subjectId=" + subjectid + "&studentId=" + studentid,true); xmlhttp.send(); }); }

关于界面gy.jsp:

DOCTYPE HTML> 学生列表 系统开发中。。。。。。。

项目截图:在这里插入图片描述在这里插入图片描述在这里插入图片描述。。。。。

具体项目源码地址:

源码地址 :   https://gitee.com/z77z/StuSystem



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3