此选课系统的要求:
1、项目需求:
本项目所开发的学生选课系统完成学校对学生的选课信息的统计与管理,减少数据漏掉的情况,同时也节约人力、物力和财力。告别以往的人工统计。
2.系统要求与功能设计
2.1 页面要求
(1)能够在Tomcat服务器中正确部署,并通过浏览器查看;
(2)网站页面整体风格统一;
(3)首页(登录页)要求实现不同用户登录后,进入的功能页不相同。
(4)教师功能页:有添加课程、修改个人信息、浏览选课学生信息三个模块。
(5)学生功能页:有修改个人信息、浏览课程信息、选课三个功能模块。
(5)管理员功能页:有添加教师信息、添加学生信息两个模块。
2.2功能要求:
(1)添加教师信息:管理员可以添加教师基本信息,教师基本信息包括:教师工号(八位数字组成,例如02000081)、教师姓名、教师性别、教师所在学院、职称(教授、副教授、讲师、助教)组成;
(2)添加学生信息:管理可以添加学生基本信息,学生基本信息包括学号(八位数字组成,例如20180052)、学生姓名、学生性别、所在班级、所属专业组成;
(3)添加课程信息:教师登陆后,可以添加自己任职的课程基本信息,课程基本信息包括:课程编号(六位数字组成,例如050013),课程名称、选课人数、任课教师(任课教师不需录入,那位教师填写课程信息,那位教师就是任课教师);
(4)修改个人信息:教师或学生登陆后可以修改个人信息,但教师工号或学号不能修改,另外教师或学生只能修改自己的信息,无法看到或修改其他学生或教师的基本信息。
(5)浏览课程信息:学生登陆后可以看到所有课程的列表信息,点击课程名称可以查看课程的详细信息,包括已选课人数;点击教师名称可以查看教师的详细信息。
(6)选课:进入选课页面,课程信息列表显示所有选课人数未达到课程设置的选课人数上限,点击课程名称可以看到课程详细信息,点击课程详细信息页面的“选课”按钮,可以实现选课功能。
(7)浏览选课学生信息:教师进入该页面后,可以看到自己设置的课程信息列表,点击课程名称,可以看到,选择该课程的所有学生基本信息列表。
(8)登陆功能:管理员、教师、学生登陆后可以看到不同的功能页面,教师或学生登陆后只能看到自己的相关信息,不同教师、不同学生登陆后无法查看其他人的信息。(要求至少创建两个教师用户、十个学生用户演示选课过程)
3数据库设计:
要求实现课程基本信息表、教师基本信息表、学生基本信息表、选课基本信息表。(提示:选课基本信息包括课程编号、教师编号、学号等基本信息)
4、WEB发布:
要求可以实现在浏览器直接访问系统。
代码:
package common; public class Class { private int id; private String classnumber;//编号 private String classname; private int classnum;//人数 private String classteacher; private int alreadynum=0; public int getId() { return id; } public void setId(int id) { this.id = id; } public Class(int id,String classnumber,String classname, int classnum,int alreadynum,String classteacher) { this.id = id; this.classname = classname; this.classnum = classnum; this.classnumber = classnumber; this.classteacher = classteacher; this.alreadynum=alreadynum; } public Class(String classnumber,String classname, int classnum,int alreadynum,String classteacher) { this.classname = classname; this.classnum = classnum; this.classnumber = classnumber; this.classteacher = classteacher; this.alreadynum=alreadynum; } public String getClassnumber() { return classnumber; } public void setClassnumber(String classnumber) { this.classnumber = classnumber; } public String getClassname() { return classname; } public void setClassname(String classname) { this.classname = classname; } public int getClassnum() { return classnum; } public void setClassnum(int classnum) { this.classnum = classnum; } public String getClassteacher() { return classteacher; } public void setClassteacher(String classteacher) { this.classteacher = classteacher; } public int getAlreadynum() { return alreadynum; } public void setAlreadynum(int alreadynum) { this.alreadynum = alreadynum; } }
package common; //学生类 public class Registerstudent { private int id; private String studentnum; private String studentname; private String studentsex; private String studentclass; private String major; private String class1; public int getId() { return id; } public void setId(int id) { this.id = id; } public Registerstudent(int id,String studentnum,String studentname, String studentsex, String studentclass,String major) { this.id = id; this.studentnum = studentnum; this.studentname=studentname; this.studentsex = studentsex; this.studentclass = studentclass; this.major = major; } public Registerstudent(String studentnum,String studentname, String studentsex, String studentclass,String major) { this.studentnum = studentnum; this.studentname=studentname; this.studentsex = studentsex; this.studentclass = studentclass; this.major = major; } public Registerstudent(String studentnum,String studentname, String studentsex, String studentclass,String major,String teacher) { this.studentnum = studentnum; this.studentname=studentname; this.studentsex = studentsex; this.studentclass = studentclass; this.major = major; this.setClass1(teacher); } public String getStudentnum() { return studentnum; } public void setStudentnum(String studentnum) { this.studentnum = studentnum; } public String getStudentname() { return studentname; } public void setStudentname(String studentname) { this.studentname = studentname; } public String getStudentsex() { return studentsex; } public void setStudentsex(String studentsex) { this.studentsex = studentsex; } public String getStudentclass() { return studentclass; } public void setStudentclass(String studentclass) { this.studentclass = studentclass; } public String getMajor() { return major; } public void setMajor(String major) { this.major = major; } public String getClass1() { return class1; } public void setClass1(String class1) { this.class1 = class1; } }
package common; //教师类 public class Teacher { private int id; private String worknumber; private String name; private String sex; private String school; private String callname; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public Teacher(int id,String worknumber,String name, String sex, String school,String callname) { this.id = id; this.name = name; this.sex = sex; this.worknumber = worknumber; this.school = school; this.callname = callname; } public Teacher(String worknumber,String name, String sex, String school,String callname) { this.name = name; this.sex = sex; this.worknumber = worknumber; this.school = school; this.callname = callname; } public String getWorknumber() { return worknumber; } public void setWorknumber(String worknumber) { this.worknumber = worknumber; } public String getSchool() { return school; } public void setSchool(String school) { this.school = school; } public String getCallname() { return callname; } public void setCallname(String callname) { this.callname = callname; } }
package Dao; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import common.depart; import common.worker; import common.Registerstudent; import common.Teacher; import common.Class; import common.kaoqin; import Helper.Help; public class Dao { /** * 添加 * @param asd * @return */ public boolean add(worker R) { String sql = "insert into worker(number,name,sex,date,bumen,juese,password) values('" +R.getNumber() + "','" + R.getName() + "','" + R.getSex() + "','" + R.getDate()+ "','" + R.getBumen()+"','" + R.getJuese()+"','" + R.getPassword()+"')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { System.out.println("数据库连接失败"); e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean add(depart R) { String sql = "insert into depart(departnum,departname) values('" +R.getDepartnum()+ "','" + R.getDepartname() + "')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean kaoqin(kaoqin R) { String sql = "insert into kaoqin(time,number,name,sex,date,bumen,kind) values('" +R.getTime() + "','" +R.getNumber() + "','" + R.getName() + "','" + R.getSex() + "','" + R.getDate()+ "','" + R.getBumen()+"','" + R.getKind()+"')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { System.out.println("插入失败!!"); e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean add(Teacher R) { String sql = "insert into teacher(worknumber,name,sex,school,callname) values('" +R.getWorknumber() + "','" + R.getName() + "','" + R.getSex() + "','" + R.getSchool()+ "','" + R.getCallname()+"')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { System.out.println("数据库连接失败"); e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean add(Class R) { String sql = "insert into class(classnumber,classname,classnum,alreadynum,classteacher) values('" +R.getClassnumber()+ "','" + R.getClassname() + "','" + R.getClassnum() +"','"+ R.getAlreadynum()+"','" + R.getClassteacher()+"')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean add(Registerstudent R) { String sql = "insert into student(studentnum,studentname,studentsex,studentclass,major) values('" +R.getStudentnum() + "','" + R.getStudentname() + "','" + R.getStudentsex() + "','" + R.getStudentclass()+ "','" + R.getMajor()+"')"; Connection conn = Help.getConn(); Statement state = null; boolean f =false ; int a = 0; try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (Exception e) { System.out.println("插入失败!!"); e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean delete (String name) { boolean f=false; String sql="delete from text2 where name='"+name+"'"; Connection conn=Help.getConn(); Statement state=null; int a=0; try { state=conn.createStatement(); a=state.executeUpdate(sql); }catch(SQLException e) { e.printStackTrace();} finally { Help.close(state, conn); } if(a>0) { f=true; } return f; } public Teacher getTeacherNum(String number) { String sql=new String("select * from teacher where worknumber='"+number+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; Teacher teacher=null; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { int id=rs.getInt("id"); String name=rs.getString("name"); String sex=rs.getString("sex"); String school=rs.getString("school"); String callname=rs.getString("callname"); teacher=new Teacher(id,number,name,sex,school,callname); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return teacher; } public boolean getTeacherNum1(String number) { String sql=new String("select * from teacher where worknumber='"+number+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; boolean f=false; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { f=true; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return f; } public Registerstudent getStudentNum(String number) { String sql=new String("select * from student where studentnum='"+number+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; Registerstudent student=null; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { int id=rs.getInt("id"); String studentname=rs.getString("studentname"); String studentsex=rs.getString("studentsex"); String studentclass=rs.getString("studentclass"); String major=rs.getString("major"); student=new Registerstudent(id,number,studentname,studentsex,studentclass,major); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return student; } public Class searchClassName(String classname) { String sql=new String("select * from class where classname='"+classname+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; Class student=null; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { int id=rs.getInt("id"); int id1=rs.getInt("alreadynum"); int id2=rs.getInt("classnum"); String classnumber=rs.getString("classnumber"); String classteacher=rs.getString("classteacher"); student=new Class(id,classnumber,classname,id2,id1,classteacher); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return student; } public Teacher searchTeacherName(String classteacher) { String sql=new String("select * from teacher where name='"+classteacher+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; Teacher student=null; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { int id=rs.getInt("id"); String worknumber=rs.getString("worknumber"); String sex=rs.getString("sex"); String school=rs.getString("school"); String callname=rs.getString("callname"); student=new Teacher(id,worknumber,classteacher,sex,school,callname); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return student; } public boolean getStudentNum1(String number) { String sql=new String("select * from student where studentnum='"+number+"'"); Connection conn=Help.getConn(); Statement statement=null; ResultSet rs=null; boolean f=false; try { statement=conn.createStatement(); rs=statement.executeQuery(sql); while(rs.next()) { f=true; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { Help.close(rs,statement, conn); } return f; } public boolean updateClass(Class te,String classname) { int alreadynum=te.getAlreadynum()+1; String sql="update class set alreadynum='"+alreadynum+"'where classname='"+classname+"'"; Connection conn=null; Statement state=null; boolean f=false; int a = 0; conn=Help.getConn(); try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean updatete(Teacher te) { String sql="update teacher set name='"+te.getName()+"',sex='"+te.getSex()+"',school='"+te.getSchool()+"',callname='"+te.getCallname()+"'where id='"+te.getId()+"'"; Connection conn=null; Statement state=null; boolean f=false; int a = 0; conn=Help.getConn(); try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean updatest1(Registerstudent st,String classname) { String sql="update student set class1='"+classname+"'where id='"+st.getId()+"'"; Connection conn=null; Statement state=null; boolean f=false; int a = 0; conn=Help.getConn(); try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public boolean updatest(Registerstudent st) { String sql="update student set studentclass='"+st.getStudentclass()+"',studentname='"+st.getStudentname()+"',studentsex='"+st.getStudentsex()+"',studentclass='"+st.getStudentclass()+"'where id='"+st.getId()+"'"; Connection conn=null; Statement state=null; boolean f=false; int a = 0; conn=Help.getConn(); try { state = conn.createStatement(); a = state.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(state, conn); } if (a > 0) { f = true; } return f; } public List<Class> display(String classteacher) { String sql = "select * from class where classteacher='"+classteacher+"'"; System.out.println(classteacher); List<Class> list = new ArrayList<Class>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Class bean = null; while (rs.next()) { int classnum= rs.getInt("classnum"); String classname =rs.getString("classname"); String classnumber= rs.getString("classnumber"); int alreadynum= rs.getInt("alreadynum"); bean = new Class(classnumber,classname,classnum,alreadynum,classteacher); list.add(bean); } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } return list; } public List<Class> list() { String sql = "select * from class"; List<Class> list = new ArrayList<>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Class bean = null; while (rs.next()) { int id = rs.getInt("id"); String username1= rs.getString("classnum"); String password1 =rs.getString("classname"); int name1= rs.getInt("classnumber"); int name2= rs.getInt("alreadynum"); String sex1 = rs.getString("classteacher"); bean = new Class(id,username1,password1, name1,name2,sex1); list.add(bean); } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } return list; } //已选人数少的 public List<Registerstudent> searchStudentName(String classname) { String sql = "select * from student where class1='"+classname+"'"; List<Registerstudent> list = new ArrayList<Registerstudent>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Registerstudent bean = null; while (rs.next()) { int id = rs.getInt("id"); String username1= rs.getString("studentnum"); String password1 =rs.getString("studentname"); String name1= rs.getString("studentsex"); String name2= rs.getString("studentclass"); String sex1 = rs.getString("major"); bean = new Registerstudent(id,username1,password1, name1,name2,sex1); list.add(bean); } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } return list; } public List<Class> list1() { String sql = "select * from class"; List<Class> list = new ArrayList<>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Class bean = null; while (rs.next()) { int id = rs.getInt("id"); String username1= rs.getString("classnum"); String password1 =rs.getString("classname"); int name1= rs.getInt("classnumber"); int name2= rs.getInt("alreadynum"); String sex1 = rs.getString("classteacher"); bean = new Class(id,username1,password1, name1,name2,sex1); if(name1>name2) { list.add(bean); } } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } return list; } public List<Class> search(String classnumber, String classname,String classteacher) { String sql = "select * from class where "; if (classnumber != "") { sql += "classnumber like '%" + classnumber + "%'"; }else if (classname != "") { sql += "classname like '%" + classname + "%'"; } else if (classteacher !="") { sql += " classteacher like '%" + classteacher + "%'"; } List<Class> list = new ArrayList<Class>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Class bean = null; while (rs.next()) { int id = rs.getInt("id"); String classnumber1= rs.getString("classnumber"); String classname1 =rs.getString("classname"); int classnum1= rs.getInt("classnum"); int alreadynum1 = rs.getInt("alreadynum"); String classteacher1 = rs.getString("classteacher"); bean = new Class(id,classnumber1,classname1, classnum1,alreadynum1,classteacher1); list.add(bean); } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } return list; } }
1 package Helper; 2 3 import java.sql.Connection; 4 import java.sql.DriverManager; 5 import java.sql.ResultSet; 6 import java.sql.SQLException; 7 import java.sql.Statement; 8 9 public class Help { 10 public static String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"; 11 public static String dbURL="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=db_platform"; 12 public static String userName="sa"; 13 public static String userPwd="w669399221"; 14 15 public static Connection getConn () { 16 Connection conn = null ; 17 18 try { 19 Class.forName(driverName);//加载驱动 20 conn = DriverManager.getConnection(dbURL, userName, userPwd); 21 22 } catch (Exception e) { 23 System.out.println("数据库连接失败!!"); 24 e.printStackTrace(); 25 } 26 27 return conn; 28 } 29 30 /** 31 * 关闭连接 32 * @param state 33 * @param conn 34 */ 35 public static void close (Statement state, Connection conn) { 36 if (state != null) { 37 try { 38 state.close(); 39 } catch (SQLException e) { 40 e.printStackTrace(); 41 } 42 } 43 44 if (conn != null) { 45 try { 46 conn.close(); 47 } catch (SQLException e) { 48 e.printStackTrace(); 49 } 50 } 51 } 52 53 public static void close (ResultSet rs, Statement state, Connection conn) { 54 if (rs != null) { 55 try { 56 rs.close(); 57 } catch (SQLException e) { 58 e.printStackTrace(); 59 } 60 } 61 62 if (state != null) { 63 try { 64 state.close(); 65 } catch (SQLException e) { 66 e.printStackTrace(); 67 } 68 } 69 70 if (conn != null) { 71 try { 72 conn.close(); 73 } catch (SQLException e) { 74 e.printStackTrace(); 75 } 76 } 77 } 78 79 }
package Servlet; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import common.depart; import common.kaoqin; import common.worker; import Dao.Dao; import Helper.Help; import common.Registerstudent; import common.Teacher; import common.Class; @WebServlet("/RegisterServlet") public class RegisterServlet extends HttpServlet { private static final long serialVersionUID = 1L; Dao dao = new Dao(); protected void service(HttpServletRequest req, HttpServletResponse resp)throws ServletException,IOException{ req.setCharacterEncoding("utf-8"); String method = req.getParameter("method"); if ("addteacher".equals(method)) { addteacher(req, resp);} else if ("addworker".equals(method)) { addworker(req, resp); } else if ("adddepart".equals(method)) { adddepart(req, resp); } else if("addstudent".equals(method)) { addstudent(req, resp); } else if("addclass".equals(method)) { addclass(req, resp); } else if("tiaozhuan".equals(method)) { tiaozhuan(req, resp); } else if("tiaozhuan1".equals(method)) { tiaozhuan1(req, resp); } else if ("del".equals(method)) { del(req, resp); } else if ("getTeacherNum".equals(method)) { getTeacherNum(req, resp); } else if ("getStudentNum".equals(method)) { getStudentNum(req, resp); } else if ("updatete".equals(method)) { updatete(req, resp); } else if ("updatest".equals(method)) { updatest(req, resp); } else if ("list".equals(method)) { list(req, resp); } else if ("display".equals(method)) { display(req, resp); } else if ("searchClassTeacher".equals(method)) { searchClassTeacher(req, resp); } else if ("searchClassName".equals(method)) { searchClassName(req, resp); } else if ("list1".equals(method)) { list1(req, resp); } else if ("chooseClass".equals(method)) { chooseClass(req, resp); } else if ("searchStudent".equals(method)) { searchStudent(req, resp); } else if ("search".equals(method)) { search(req, resp); } } /** * 添加 * @param req * @param resp * @throws IOException * @throws ServletException */ String numberbest=""; String passwordbest=""; private void tiaozhuan(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); numberbest = req.getParameter("number"); passwordbest=req.getParameter("password"); String t1=new String(); for(int i=0;i<4;i++) { t1+=numberbest.charAt(i); } if(t1.equals("2018")) { if(dao.getStudentNum1(numberbest)) { req.setAttribute("message","学生登录" ); req.getRequestDispatcher("worker.jsp").forward(req,resp); } else if(dao.getTeacherNum1(numberbest)) { req.setAttribute("message","教师登录" ); req.getRequestDispatcher("worker.jsp").forward(req,resp); } else { req.setAttribute("message", "无该用户信息"); } } else { req.getRequestDispatcher("guanli.jsp").forward(req,resp); } } private void addworker(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); String number = req.getParameter("number"); String name= req.getParameter("name"); String sex = req.getParameter("sex"); String date= req.getParameter("date"); String bumen= req.getParameter("bumen"); String juese=req.getParameter("juese"); String password=req.getParameter("password"); worker R = new worker(number,name,sex,date,bumen,juese,password); //添加后消息显示 if(dao.add(R)) { req.setAttribute("message", "添加成功!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } else { req.setAttribute("message", "添加失败!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } } private void adddepart(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); String number = req.getParameter("departnum"); String name= req.getParameter("departname"); depart R = new depart(number,name); //添加后消息显示 if(dao.add(R)) { req.setAttribute("message", "添加成功!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } else { req.setAttribute("message", "添加失败!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } } private void addteacher(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); String worknumber = req.getParameter("worknumber"); String name= req.getParameter("name"); String sex = req.getParameter("sex"); String school= req.getParameter("school"); String callname = req.getParameter("callname"); Teacher R = new Teacher(worknumber,name,sex, school,callname); //添加后消息显示 if(dao.add(R)) { req.setAttribute("message", "添加成功!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } else { req.setAttribute("message", "添加失败!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } } private void addclass(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String classnumber = req.getParameter("classnumber"); String classname= req.getParameter("classname"); int classnum = Integer.parseInt(req.getParameter("classnum")); int alreadynum=Integer.parseInt(req.getParameter("alreadynum")); String classteacher= req.getParameter("classteacher"); Class R = new Class(classnumber,classname,classnum,alreadynum,classteacher); //添加后消息显示 if(dao.add(R)) { req.setAttribute("message", "添加成功!"); } else { req.setAttribute("message", "添加失败!"); } req.getRequestDispatcher("Temanagement.jsp").forward(req,resp); } private void addstudent(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String studentnum = req.getParameter("studentnum"); String studentname= req.getParameter("studentname"); String studentsex = req.getParameter("studentsex"); String studentclass= req.getParameter("studentclass"); String major = req.getParameter("major"); Registerstudent R = new Registerstudent(studentnum,studentname,studentsex,studentclass,major); //添加后消息显示 if(dao.add(R)) { req.setAttribute("message", "添加成功!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } else { req.setAttribute("message", "添加失败!"); req.getRequestDispatcher("guanli.jsp").forward(req,resp); } } private void del(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); String name = req.getParameter("name"); if(dao.delete(name)) { req.setAttribute("message", "删除成功!"); req.getRequestDispatcher("main.jsp").forward(req,resp); } else { req.setAttribute("message", "删除失败!"); req.getRequestDispatcher("main.jsp").forward(req,resp); } } private void getTeacherNum(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); Teacher teacher=dao.getTeacherNum(numberbest); req.setAttribute("teacher", teacher); req.getRequestDispatcher("updatete.jsp").forward(req,resp); } private void chooseClass(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); Class class1=dao.searchClassName(req.getParameter("classname")); Registerstudent student=dao.getStudentNum(numberbest); if(dao.updateClass(class1,req.getParameter("classname"))&&dao.updatest1(student,req.getParameter("classname"))) { req.setAttribute("message", "选课成功"); } else { req.setAttribute("message", "选课失败"); } req.getRequestDispatcher("Stmanagement.jsp").forward(req,resp); } private void searchClassName(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); Class class1=dao.searchClassName(req.getParameter("classname")); System.out.println(req.getParameter("classname")); req.setAttribute("class1", class1); if(req.getParameter("flag").contentEquals("false")) { req.getRequestDispatcher("ScanClass.jsp").forward(req,resp); } else { req.getRequestDispatcher("ScanClass1.jsp").forward(req,resp); //如何实现jsp条件隐藏。 } } private void searchStudent(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String classname=req.getParameter("classname"); List<Registerstudent>class1=new ArrayList<Registerstudent>(); class1=dao.searchStudentName(classname); System.out.println(req.getParameter("classname")); req.setAttribute("class1", class1); req.getRequestDispatcher("ScanClassTeacher.jsp").forward(req,resp); //如何实现jsp条件隐藏。 } private void searchClassTeacher(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); Teacher teacher=dao.searchTeacherName(req.getParameter("classteacher")); req.setAttribute("teacher", teacher); req.getRequestDispatcher("ScanTeacher.jsp").forward(req,resp); } //多条件查询 private void search(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String power=req.getParameter("power"); String power1=req.getParameter("power1"); String power2=req.getParameter("power2"); String tiaojian=req.getParameter("tiaojian"); String tiaojian1=req.getParameter("tiaojian1"); String tiaojian2=req.getParameter("tiaojian2"); String guanxi=req.getParameter("guanxi"); String guanxi1=req.getParameter("guanxi1"); String classnumber=new String(); String classname=new String(); String classteacher=new String(); if(power.equals("1")) { classnumber=req.getParameter("wenben"); } else if(power.equals("2")) { classname=req.getParameter("wenben"); } else if(power.equals("3")) { classteacher=req.getParameter("wenben"); } if(power1.equals("1")) { classnumber=req.getParameter("wenben1"); } else if(power1.equals("2")) { classname=req.getParameter("wenben1"); } else if(power1.equals("3")) { classteacher=req.getParameter("wenben1"); } if(power2.equals("1")) { classnumber=req.getParameter("wenben2"); } else if(power2.equals("2")) { classname=req.getParameter("wenben2"); } else if(power2.equals("3")) { classteacher=req.getParameter("wenben2"); } //sql语句 String sql = "select * from class where "; //模糊精确 if(!classnumber.equals("")) { if(tiaojian.equals("1")) { sql+="classnumber like '%" + classnumber + "%'"; } else { sql+="classnumber = '" + classnumber + "'"; } } if(guanxi.equals("1")) { if(tiaojian1.equals("1")) { sql+=" classname like '%" + classname + "%'"; } else { sql+=" classname = '" + classname + "'"; } } else if(guanxi.equals("2")) { if(tiaojian1.equals("1")) { sql+="or classname like '%" + classname + "%'"; } else { sql+="or classname = '" + classname + "'"; } } if(guanxi1.equals("1")) { if(tiaojian2.equals("1")) { sql+=" classteacher like '%" + classteacher + "%'"; } else { sql+=" classteacher = '" + classteacher + "'"; } } if(guanxi1.equals("2")) { if(tiaojian2.equals("1")) { sql+="or classteacher like '%" + classteacher + "%'"; } else { sql+="or classteacher = '" + classteacher + "'"; } } List<Class> list = new ArrayList<>(); Connection conn = Help.getConn(); Statement state = null; ResultSet rs = null; try { state = conn.createStatement(); rs = state.executeQuery(sql); Class bean = null; while (rs.next()) { String classnumber1= rs.getString("classnumber"); String classname1 =rs.getString("classname"); int classnum1= rs.getInt("classnum"); int alreadynum1 = rs.getInt("alreadynum"); String classteacher1 = rs.getString("classteacher"); bean = new Class(classnumber1,classname1, classnum1,alreadynum1,classteacher1); list.add(bean); } } catch (SQLException e) { e.printStackTrace(); } finally { Help.close(rs, state, conn); } req.setAttribute("list",list); req.getRequestDispatcher("bianli.jsp").forward(req,resp); } //老师查询自己的课程 private void display(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); Teacher teacher=dao.getTeacherNum(numberbest); List<Class> list3 = dao.display(teacher.getName()); req.setAttribute("list3",list3); req.getRequestDispatcher("ScanClassTeacher.jsp").forward(req,resp); } private void tiaozhuan1(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); Teacher teacher=dao.getTeacherNum(numberbest); req.setAttribute("teacher", teacher); req.getRequestDispatcher("addclass.jsp").forward(req,resp); } //获取学生工号信息 private void getStudentNum(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); Registerstudent student=dao.getStudentNum(numberbest); req.setAttribute("student", student); req.getRequestDispatcher("updatest.jsp").forward(req,resp); } //更新教师信息 private void updatete(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); int id = Integer.parseInt(req.getParameter("id")); String worknumber=req.getParameter("worknumber"); String name=req.getParameter("name"); String sex=req.getParameter("sex"); String school=req.getParameter("school"); String callname=req.getParameter("callname"); Teacher teacher=new Teacher(id,worknumber,name,sex,school,callname); if(dao.updatete(teacher)) { req.setAttribute("message","修改成功"); } else { req.setAttribute("message", "修改失败"); } req.getRequestDispatcher("updatete.jsp").forward(req,resp); } private void updatest(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("utf-8"); int id = Integer.parseInt(req.getParameter("id")); String studentnum=req.getParameter("studentnum"); String studentname=req.getParameter("studentname"); String studentsex=req.getParameter("studentsex"); String studentclass=req.getParameter("studentclass"); String major=req.getParameter("major"); Registerstudent student=new Registerstudent(id,studentnum,studentname,studentsex,studentclass,major); if(dao.updatest(student)) { req.setAttribute("message","修改成功"); } else { req.setAttribute("message", "修改失败"); } req.getRequestDispatcher("updatete.jsp").forward(req,resp); } /** * 修改 * @param req * @param resp * @throws IOException * @throws ServletException */ /*private void update(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); int id = Integer.parseInt(req.getParameter("id")); String name= req.getParameter("name"); String sex = req.getParameter("sex"); String minzu= req.getParameter("minzu"); String zhucetime = req.getParameter("zhucetime"); int age= Integer.parseInt(req.getParameter("age")); String mianmao = req.getParameter("mianmao"); String fuwu= req.getParameter("fuwu"); Registerstudent R = new Registerstudent(name,sex, minzu,zhucetime,age,mianmao,fuwu); if(dao.update(R)) { req.setAttribute("message", "修改成功"); } else { req.setAttribute("message", "修改失败"); } req.getRequestDispatcher("main.jsp").forward(req,resp); } /** * 查找 * @param req * @param resp * @throws ServletException */ /*private void search(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String username= req.getParameter("username"); String password = req.getParameter("password"); String name= req.getParameter("name"); String sex = req.getParameter("sex"); String studynumber= req.getParameter("studynumber"); String xueyuan = req.getParameter("xueyuan"); String xi= req.getParameter("xi"); String classname = req.getParameter("classname"); String ruxueyear = req.getParameter("ruxueyear"); String hometown = req.getParameter("hometown"); String beizhu = req.getParameter("beizhu"); String mail = req.getParameter("mail"); List<Registerstudent> Car = dao.search(username,password, name,sex,studynumber,mail,xueyuan,xi,classname,ruxueyear,hometown,beizhu); req.setAttribute("Car", Car); req.getRequestDispatcher("searchlist.jsp").forward(req,resp); } /* * 全部 * @param req * @param resp * @throws ServletException */ private void list(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); List<Class> list1 = dao.list(); req.setAttribute("list1",list1); req.getRequestDispatcher("Scanst.jsp").forward(req,resp); } private void list1(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); List<Class> list1 = dao.list1(); req.setAttribute("list1",list1); req.getRequestDispatcher("Scanst1.jsp").forward(req,resp); } } /** * 通过ID得到Car * @param req * @param resp * @throws ServletException */ /*private void getPassById(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); int id = Integer.parseInt(req.getParameter("id")); Registerstudent Car = dao.getPassById(id); req.setAttribute("Register", Car); req.getRequestDispatcher("detail2.jsp").forward(req,resp); } /** * 通过品牌查找 * 跳转至删除 * @param req * @param resp * @throws IOException * @throws ServletException */ /*private void getPassByBrand(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String name = req.getParameter("name"); Registerstudent use = dao.getPassByBrand(name); if(use== null) { req.setAttribute("message", "无该用户信息!"); req.getRequestDispatcher("main.jsp").forward(req,resp); } else { req.setAttribute("use",use); req.getRequestDispatcher("searchlist.jsp").forward(req,resp); } } private void getPassByUsername(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException{ req.setCharacterEncoding("utf-8"); resp.setContentType("text/html;charset=UTF-8"); String name = req.getParameter("name"); Registerstudent use = dao.getPassByBrand(name); if(name== null) { req.setAttribute("message", "无该用户信息!"); req.getRequestDispatcher("main.jsp").forward(req,resp); } else { req.setAttribute("use",use); req.getRequestDispatcher("register1.jsp").forward(req,resp); } } } */
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>课程添加页面</title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <form action="RegisterServlet?method=addclass" method="post" onsubmit="return check()"> <div class="a"> 课程编号:<input type="text" id="classnumber" name="classnumber" /> </div> <div class="a"> 课程名称:<input type="text" id="classname" name="classname" /> </div> <div class="a"> 课程人数:<input type="text" id="classnum" name="classnum" /> </div> <div class="a"> 已选人数:<input type="text" id="alreadynum" name="alreadynum" value="0"/> </div> <div class="a"> 教师名称:<input type="text" id="classteacher" name="classteacher" value="${teacher.name}"/> </div> <button type="submit" >添加</button> </form> </div> <script type="text/javascript"> function check() { var studentnum = document.getElementById("classnumber"); var studentname = document.getElementById("classname"); var studentsex = document.getElementById("classnum"); //非空 if(studentnum.value == '') { alert('课程编号为空'); studentnum.focus(); return false; } else if(studentname.value == '') { alert('课程名称为空'); studentname.focus(); return false; } else if(studentsex.value == '') { alert('课程人数为空'); studentsex.focus(); return false; } } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>学生添加页面</title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <a href="guanli.jsp">返回管理页面</a> <form action="RegisterServlet?method=addstudent" method="post" onsubmit="return check()"> <div class="a"> 学号:<input type="text" id="studentnum" name="studentnum" /> </div> <div class="a"> 学生姓名:<input type="text" id="studentname" name="studentname" /> </div> <div class="a"> 学生性别:<input type="radio" name="studentsex" id="sex" value="男" checked>男 <input type="radio" name="studentsex" id="sex" value="女">女 </div> <div class="a"> 所在班级:<input type="text" id="studentclass" name="studentclass"/> </div> <div class="a"> 所属专业:<input type="text" id="major" name="major"/> </div> <div class="a"> <button type="submit" >添加</button> </div> </form> <div class="a"> </div> </div> <script type="text/javascript"> function check() { var studentnum = document.getElementById("studentnum"); var studentname = document.getElementById("stduentname"); var studentsex = document.getElementById("studentsex"); var stduentclass = document.getElementById("studentclass"); var major = document.getElementById("major"); //非空 if(studentnum.value == '') { alert('学号为空'); studentnum.focus(); return false; } else if(studentname.value == '') { alert('姓名为空'); studentname.focus(); return false; } else if(studentsex.value == '') { alert('性别为空'); studentsex.focus(); return false; } else if(studentclass.value == '') { alert('班级为空'); studentclass.focus(); return false; } else if(major.value == '') { alert('专业为空'); major.focus(); return false; } else if (!studentnum.value.match(/^2018d{4}$/)) { alert("学号由八位构成且 前四位为2018"); studentnumr.focus(); return false;} } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>教师添加页面</title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <a href="guanli.jsp">返回管理页面</a> <form action="RegisterServlet?method=addteacher" method="post" onsubmit="return check()"> <div class="a"> 教师工号:<input type="text" id="worknumber" name="worknumber" /> </div> <div class="a"> 姓名:<input type="text" id="name" name="name" /> </div> <div class="a"> 性别:<input type="radio" name="sex" id="sex" value="男" checked>男 <input type="radio" name="sex" id="sex" value="女">女 </div> <div class="a"> 所在院校:<input type="text" id="school" name="school"/> </div> <div class="a"> 职称:<select id="callname" name="callname" > <option value="教授">教授</option> <option value="副教授">副教授</option> <option value="讲师">助教</option> </select> </div> <div class="a"> <button type="submit" >添加</button> </div> </form> <div class="a"> </div> </div> <script type="text/javascript"> function check() { var worknumber = document.getElementById("worknumber"); var name = document.getElementById("name");; var sex = document.getElementById("sex"); var school = document.getElementById("school"); var callname = document.getElementById("callname"); //非空 if (!worknumber.value.match(/^0200d{4}$/)) { alert(" 工号由八位构成,且前四位是0200"); worknumber.focus(); return false;} else if(sex.value == '') { alert('性别为空'); sex.focus(); return false; } else if(name.value == '') { alert('姓名为空'); name.focus(); return false; } else if(school.value == '') { alert('所在院校为空'); school.focus(); return false; } else if(worknumber.value == '') { alert('工号为空'); worknumber.focus(); return false; } else if(callname.value == '') { alert('职称为空'); callname.focus(); return false; } } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <form action="RegisterServlet?method=tiaozhuan" method="post" onsubmit="return check()"> <div class="a"> 工号:<input type="text" id="number" name="number" /> </div> <div class="a"> 密码:<input type="password" id="password" name="password" /> </div> <div class="a"> <button type="submit" >登录</button> </div> </form> <div class="a"> </div> </div> <script type="text/javascript"> function check() { var number = document.getElementById("number"); var name = document.getElementById("name"); //非空 if(number.value == '') { alert('学号为空'); number.focus(); return false; } else if(password.value == '') { alert('密码为空'); password.focus(); return false; } } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body style="background-color:greenyellow;font-family:'Microsoft JhengHei';"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <div > <a href="addst.jsp">添加学生信息</a> </div> <div > <a href="addte.jsp">添加教师信息</a> </div> <div > <a href="denglu.jsp">退出登录</a> </div> </div> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>浏览课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr align="center"><td>课程编号</td><td>课程名称</td><td>课程容量</td><td>已选人数</td><td>课程教师</td><td>选项</td></tr> <tr align="center"> <td>${class1.classnumber}</td> <td>${class1.classname}</td> <td>${class1.classnum }</td> <td>${class1.alreadynum }</td> <td>${class1.classteacher }</td> <td><a href="RegisterServlet?method=chooseClass&classname=${class1.classname}">选课</a> </tr> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>学生课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr align="center"><td>课程编号</td><td>课程名称</td><td>课程容量</td><td>已选人数</td><td>课程教师</td></tr> <c:forEach items="${list3}" var="list" > <tr align="center"> <td>${list.classnumber}</td> <td><a href="RegisterServlet?method=searchStudent&classname=${list.classname}">${list.classname}</a></td> <td>${list.classnum}</td> <td>${list.alreadynum}</td> <td>${list.classteacher}</td> </tr> </c:forEach> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>浏览课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr ><td>课程编号</td><td>课程名称</td><td>教师名称</td></tr> <c:forEach items="${list1}" var="list"> <tr > <td>${list.classnum}</td><td><a href="RegisterServlet?method=searchClassName&classname=${list.classname}&flag=false">${list.classname}</a></td> <td><a href="RegisterServlet?method=searchClassTeacher&classteacher=${list.classteacher}">${list.classteacher}</a></td> </tr> </c:forEach> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教师详细信息</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr align="center"><td>教师工号</td><td>教师姓名</td><td>教师性别</td><td>所在学院</td><td>教师职称</td></tr> <tr align="center"> <td>${teacher.worknumber}</td> <td>${teacher.name}</td> <td>${teacher.sex }</td> <td>${teacher.school}</td> <td>${teacher.callname}</td> </tr> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>学生课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr align="center"><td>学生学号</td><td>学生姓名</td><td>学生性别</td><td>所在班级</td><td>专业</td></tr> <c:forEach items="${list1}" var="class1"> <tr align="center"> <td>${class1.studentnum}</td> <td>${class1.studentname}</td> <td>${class1.studentsex}</td> <td>${class1.studentclass}</td> <td>${class1.major}</td> </tr> </c:forEach> </table> <a class="abc" href="Temanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Insert title here</title> </head> <body style="background-color:yellowblue;font-family:'Microsoft JhengHei';"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <a href="RegisterServlet?method=list">浏览课程信息</a> <br/> <a href="RegisterServlet?method=getStudentNum">修改个人信息</a> <br/> <a href="RegisterServlet?method=list1">选课</a> <div > <a href="denglu.jsp">退出登录</a> </div> </div> </body> </html>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Insert title here</title> </head> <body style="background-color:yellowblue;font-family:'Microsoft JhengHei';"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align=center> <a href="RegisterServlet?method=getTeacherNum">修改个人信息</a> <br/> <a href="RegisterServlet?method=tiaozhuan1">添加课程信息</a> <br/> <a href="RegisterServlet?method=display">浏览选课学生信息</a> <div > <a href="denglu.jsp">退出登录</a> </div> </div> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>学生信息修改页面</title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <form action="RegisterServlet?method=updatest" method="post" onsubmit="return check()"> <div class="a"> id:<input type="text" id="studentnum" name="studentnum" value="${student.id}" /> </div> <div class="a"> 学生学号:<input type="text" id="studentnum" name="studentnum" value="${student.studentnum}" /> </div> <div class="a"> 姓名:<input type="text" id="studentname" name="studentname" value="${student.studentname}"/> </div> <div class="a"> 性别:<input type="radio" name="studentsex" id="sex" value="男" checked>男 <input type="radio" name="studentsex" id="sex" value="女">女 </div> <div class="a"> 所在班级:<input type="text" name="studentclass" value="${student.studentclass}"/> </div> <div class="a"> 专业:<input type="text" name="major" value="${student.major}"/> </div> <div class="a"> <button type="submit" >修改</button> </div> </form> </div> <script type="text/javascript"> function check() { var worknumber = document.getElementById("studentnum"); var name = document.getElementById("studentname");; var sex = document.getElementById("studentsex"); var school = document.getElementById("studentclass"); var callname = document.getElementById("major"); //非空 if(worknumber.value!='${student.studentnum}') { alert("工号不能修改!!!"); worknumber.focus(); return false; } else if(sex.value == '') { alert('性别为空'); sex.focus(); return false; } else if(name.value == '') { alert('姓名为空'); name.focus(); return false; } else if(school.value == '') { alert('班级为空'); school.focus(); return false; } else if(callname.value == '') { alert('专业为空'); callname.focus(); return false; } } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>教师信息修改页面</title> </head> <body style="font-family:'Microsoft JhengHei';background-color:greenyellow;"> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <form action="RegisterServlet?method=updatete" method="post" onsubmit="return check()"> <div class="a"> 姓名:<input type="text" id="id" name="id" value="${teacher.id}"/> </div> <div class="a"> 教师工号:<input type="text" id="worknumber" name="worknumber" value="${teacher.worknumber}" /> </div> <div class="a"> 姓名:<input type="text" id="name" name="name" value="${teacher.name}"/> </div> <div class="a"> 性别:<input type="radio" name="sex" id="sex" value="男" checked>男 <input type="radio" name="sex" id="sex" value="女">女 </div> <div class="a"> 所在院校:<input type="text" id="school" name="school" value="${teacher.school}"/> </div> <div class="a"> 职称:<select id="callname" name="callname" > <option value="教授">教授</option> <option value="副教授">副教授</option> <option value="讲师">助教</option> </select> </div> <div class="a"> <button type="submit" >添加</button> </div> </form> <div class="a"> </div> </div> <script type="text/javascript"> function check() { var worknumber = document.getElementById("worknumber"); var name = document.getElementById("name");; var sex = document.getElementById("sex"); var school = document.getElementById("school"); var callname = document.getElementById("callname"); //非空 if(worknumber!=${teacher.worknumber}) { alert("工号不能修改!!!"); worknumber.focus(); return false; } else if(sex.value == '') { alert('性别为空'); sex.focus(); return false; } else if(name.value == '') { alert('姓名为空'); name.focus(); return false; } else if(school.value == '') { alert('所在院校为空'); school.focus(); return false; } else if(worknumber.value == '') { alert('工号为空'); worknumber.focus(); return false; } else if(callname.value == '') { alert('职称为空'); callname.focus(); return false; } } </script> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>浏览课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr ><td>课程编号</td><td>课程名称</td><td>教师名称</td></tr> <c:forEach items="${list1}" var="list"> <tr > <td>${list.classnum}</td><td><a href="RegisterServlet?method=searchClassName&classname=${list.classname}&flag=true">${list.classname}</a></td> <td>${list.classteacher}</td> </tr> </c:forEach> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>浏览课程页面</title> </head> <style> .abc{ font-family:"黑体"; margin-top: 20px; background-color: white; 600px; margin-left:550px; } </style> <body bgcolor="blue"> <table border="1" class="abc"> <tr align="center"><td>课程编号</td><td>课程名称</td><td>课程容量</td><td>已选人数</td><td>课程教师</td></tr> <tr align="center"> <td>${class1.classnumber}</td> <td>${class1.classname}</td> <td>${class1.classnum }</td> <td>${class1.alreadynum }</td> <td>${class1.classteacher }</td> </tr> </table> <a class="abc" href="Stmanagement.jsp">返回主页</a> </body> </html>