基于javaweb+mysql的jsp+servlet学校在线报考系统(java+jsp+javascript+servlet+mysql)

基于javaweb+mysql的jsp+servlet学校在线报考系统(java+jsp+javascript+servlet+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb+mysql的JSP+Servlet学校在线报考系统(java+jsp+javascript+servlet+mysql)

项目介绍

本项目分为管理员、教务人员、招生人员、学生等角色;

管理员角色主要功能包括: 系统状态、阶段定义、管理员维护、数据库管理、查看报名信息、我的登录历史、修改密码、退出系统;

教务人员主要功能包括: 系统状态、查看报名信息、准考证号分配、考场分配、录入成绩、我的登录历史、修改密码、退出系统;

招生人员主要功能包括: 系统状态、阶段设置、招考信息设置、查看报名信息、现场确认、学生密码清零、我的登录历史、修改密码、退出系统;

学生角色主要功能包括: 报考须知、我的报名信息、上传照片、报名表打印、准考证打印、成绩与录取查询、我的登录历史、修改密码、退出系统等;

环境需要

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

技术栈

  1. 后端:Servlet 2. 前端:JSP+JavaScript+CSS

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中WebRoot/META-INF/context.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,学生角色使用http://localhost:8080/bkxt/index.jsp进行登录 学生账号/密码:zjfhit/123456 管理员登录:http://localhost:8080/bkxt/manage.jsp 管理员账号/密码:manager/123456 教务人员账号/密码:jiaowu/123456 招生人员账号/密码:zhaoban/123456
          request.removeAttribute("newpass");
          request.removeAttribute("confirmpass");
          request.removeAttribute("code");
          session.removeAttribute("adminuser");
          request.setAttribute("adminLoginMess", "* 密码修改成功,请重新登录!");
          request.getRequestDispatcher("/manage.jsp").forward(request, response); 
        } else {
          request.setAttribute("passModifyMess", "* 密码修改失败!");
          request.getRequestDispatcher("/admin/pass.jsp").forward(request, response);
        }
      }
    }
  }

  private String validateForm(String oldpass,String newpass,String confirmpass,String code){
    if (oldpass == null || !oldpass.matches("\\w{6,20}")){
      return "* 旧密码错误!";
    }else if (newpass == null || !newpass.matches("\\w{6,20}")) {
      return "* 新密码不合法!";
    }else if (!newpass.equals(confirmpass)) {
      return "* 两次输入的新密码不一致,请重新输入!";
    }else if (code == null || !code.matches("\\d{4}")) {
      return "* 验证码错误!";
    }
    return "";
  }
  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
    // Put your code here
  }

}


public class JAdminRoom extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public JAdminRoom() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 * 
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request
	 *            the request send by the client to the server
	 * @param response
	 *            the response send by the server to the client
	 * @throws ServletException
	 *             if an error occurred
	 * @throws IOException
	 *             if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		this.doPost(request, response);
	}

	/**
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

   this.doPost(request, response);
  }

  /**
   * The doPost method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to post.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    int pageSize = request.getParameter("pageSize") == null ? 5 : Integer.parseInt(request.getParameter("pageSize").toString());
    int pageNo = request.getParameter("pageNo") == null ? 1 : Integer.parseInt(request.getParameter("pageNo").toString());

    HttpSession session = request.getSession();
    RecordDao recordDao = new RecordDaoImpl();
    System.out.println(pageNo);
    PageModel<SupGrade> pm =  recordDao.pageByLogname(pageSize, pageNo);
    pm.setPageNav(request.getRequestURI());
    
    File file = (File)request.getAttribute("file1");
	if(file != null){
		try {
			GradeDaoImpl gradeImpl = new GradeDaoImpl();
			Workbook workbook = Workbook.getWorkbook(file);
			Sheet sheet = workbook.getSheet(0);
			for(int row = 2;row < sheet.getRows()-1;row++){
				SupGrade supgrade = new SupGrade();
				supgrade.setTestcardnum(sheet.getCell(1,row).getContents().trim());
				supgrade.setSname(sheet.getCell(2,row).getContents().trim());
				supgrade.setCname(sheet.getCell(3,row).getContents().trim());
				supgrade.setScore(Integer.parseInt(sheet.getCell(4,row).getContents().trim()));
				supgrade.setNote(sheet.getCell(5,row).getContents().trim());
				gradeImpl.gradeAdd(supgrade);	
				}
		} catch (BiffException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
    request.setAttribute("pm", pm);
    request.getRequestDispatcher("/jadmin/grade.jsp").forward(request, response);
  }

  /**
    this.doPost(request, response);
  }

  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html; charset=utf-8");
    ServletContext servletContext = request.getServletContext();
    HttpSession session = request.getSession();
    StageDao stageDao = new StageDaoImpl();
    String action = request.getParameter("action");
    
    if ("stageAdd".equals(action)){
      int stagenum = Integer.parseInt(request.getParameter("stagenum").toString());
      Stage stage = new Stage();
      stage.setStagenum(stagenum);
      stage.setStagename(request.getParameter("stagename"));
      stage.setStarttime(request.getParameter("starttime"));
      stage.setEndtime(request.getParameter("endtime"));
      stage.setNote(request.getParameter("note"));
      if(stageDao.findByStagenum(stagenum) != null){
        session.setAttribute("mess", new Message("stageAddMess", "阶段编号不能重复!"));
      }else if(stageDao.add(stage) != 0){
        servletContext.setAttribute("stages", stageDao.findAll());
        session.setAttribute("mess", new Message("stageAddMess", "添加阶段成功!"));
      }else{
        session.setAttribute("mess", new Message("stageAddMess", "添加阶段失败!"));
      }
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp#add");
    //删除系统阶段
    }else if("stageDelete".equals(action)){
      int stagenum = Integer.parseInt(request.getParameter("stagenum").toString());;
      if(stageDao.deleteByStagenum(stagenum) != 0){
        servletContext.setAttribute("stages", stageDao.findAll());
        session.setAttribute("mess", new Message("stageDeleteMess", "阶段删除成功!"));
      }else{
        session.setAttribute("mess", new Message("stageDeleteMess", "阶段删除失败!"));
      }
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp");
    //其他情况
    }else{
      session.removeAttribute("mess");
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp");
    }
  }

  /**
   * Initialization of the servlet. <br>
		String message = null;
		Date date=new Date();
		DateFormat format=new SimpleDateFormat("yyyyMMddHHmmss");
		String time=format.format(date);

		try {
			su.initialize(getServletConfig(), request, response);
			su.setMaxFileSize(1000000);
			su.setAllowedFilesList("sql");
			su.upload();
			com.jspsmart.upload.File file = su.getFiles().getFile(0);
			if (file.isMissing()) {
				message = "*请先选择要上传的文件";
			} else {
				file.saveAs(relativepath + time+".sql",SmartUpload.SAVE_VIRTUAL);	
				message = "*上传成功!";
			}

		}catch (SecurityException e) {
			if (e.getMessage().trim().matches("(.*)1010\\)\\.$")) {
				message = "*上传的文件类型不正确!";
			} else if (e.getMessage().trim().matches("(.*)1105\\)\\.$")) {
				message = "*文件大小超出了1M!";
			}else {
				message = "*上传错误!";
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		Process process = runtime.exec("cmd /c mysql -uroot -proot bkxt <C:/Progra~1/apache-tomcat-7.0.56/webapps/bkxt/backup/"+time+".sql");	
		try {
			int tag = process.waitFor();
			if(tag == 0){
				 session.setAttribute("mess", new Message("restoreMess", "还原成功"));
			}else{
				session.setAttribute("mess", new Message("restoreMess", message+" 还原失败"));
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		response.sendRedirect(servletContext.getContextPath()+"/sadmin/db.jsp");
	}

  }

  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
}

public class StuEntry extends HttpServlet {

  /**
   * Constructor of the object.
   */
  public StuEntry() {
    super();
  }

  /**
   * Destruction of the servlet. <br>
   */
  public void destroy() {
    super.destroy(); // Just puts "destroy" string in log
    // Put your code here
  }

  /**
   * The doGet method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to get.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
    AdminuserDao adminuserDao = new AdminuserDaoImpl();
    RecordDao recordDao = new RecordDaoImpl();
    
    String adminname = request.getParameter("adminname");
    String adminpass = request.getParameter("adminpass");
    String code = request.getParameter("code");
    
    /*表单数据保存至request作用域*/
    request.setAttribute("adminname", adminname);
    request.setAttribute("adminpass", adminpass);
    request.setAttribute("code", code);
    /*表单数据规范性的服务器端验证*/
    String mess = validateForm(adminname, adminpass, code);
    if (!"".equals(mess)){
      request.setAttribute("adminLoginMess", mess);
      request.getRequestDispatcher("/manage.jsp").forward(request, response);
    }else {
      String sessioncode = session.getAttribute("sessioncode").toString();
      
      if (!code.equals(sessioncode)) {
        request.setAttribute("adminLoginMess", "* 验证码错误!");
        request.getRequestDispatcher("/manage.jsp").forward(request, response);
      }else {
        Adminuser adminuser = adminuserDao.validateLogin(adminname, Encrypt.SHA(adminpass));
        if (adminuser == null) {
          request.setAttribute("adminLoginMess", "* 用户名或密码输入错误!");
          request.getRequestDispatcher("/manage.jsp").forward(request, response);
        }else {
          Record record = new Record();
          record.setLogname(adminuser.getAdminname());
          record.setUsergroup(adminuser.getAdmingroup());
          record.setLogip(request.getRemoteAddr());
          if (recordDao.add(record) != 0) {
            session.setAttribute("adminuser", adminuser);
            response.sendRedirect(request.getContextPath() + "/admin/state.jsp");
            
          } else {
            request.setAttribute("adminLoginMess", "* 登录异常!");
            request.getRequestDispatcher("/manage.jsp").forward(request, response);
          }
        }
      }
    }
  }
  
  
  private String validateForm(String adminname,String adminpass,String code){
    if (adminname == null || !adminname.matches("\\w{6,20}")){
      return "* 用户名错误!";
    }else if (adminpass == null || !adminpass.matches("\\w{6,20}")) {
  }

  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    this.doPost(request, response);
  }

 
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html; charset=utf-8");
    AdminuserDao adminuserDao = new AdminuserDaoImpl();
    String action = request.getParameter("action");
    if("findAll".equals(action)){
      ArrayList<Adminuser> adminusers = adminuserDao.findAll();
      request.setAttribute("adminusers", adminusers);
      request.getRequestDispatcher("/sadmin/manage.jsp").forward(request, response);
    }else {
      if ("add".equals(action)){
        String adminname = request.getParameter("adminname");
        String adminpass = request.getParameter("adminpass");
        String admingroup = request.getParameter("admingroup");
        Adminuser adminuser = new Adminuser();
        adminuser.setAdminname(adminname);
        adminuser.setAdminpass(Encrypt.SHA(adminpass));
        adminuser.setAdmingroup(admingroup);
        request.setAttribute("newadmin", adminuser);
        String mess = validateForm(adminname, adminpass, admingroup);
        if (!"".equals(mess)){
          request.setAttribute("addMess", mess);
        }else {
          if(adminuserDao.findByAdminname(adminname) != null){
            request.setAttribute("addMess", "* 用户名已存在!");
          }else if(adminuserDao.add(adminuser) != 0 ){
            request.removeAttribute("newadmin");
            request.setAttribute("addMess", "* 添加新管理员成功!");
          }else {
            request.setAttribute("addMess", "* 添加新管理员失败!");
          }
        }
      }else if ("deleteByAdminname".equals(action)){
        String adminname = request.getParameter("adminname");
        if(adminuserDao.findByAdminname(adminname).getAdmingroup().equals("系统管理员")){
          request.setAttribute("manageMess", "* 不能删除系统管理员!");
        }else if(adminuserDao.deleteByAdminname(adminname) != 0){
          request.setAttribute("manageMess", "* 删除管理员成功!");
        }else{
          request.setAttribute("manageMess", "* 删除管理员失败!");
        }
      }else if ("passReset".equals(action)){
        String adminname = request.getParameter("adminname");
        if(adminuserDao.passModify(adminname,Encrypt.SHA("000000")) != 0){
          request.setAttribute("manageMess", "* 管理员密码清零成功!");
        }else{
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
    // Put your code here
  }

}

public class AdminPass extends HttpServlet {

  /**
   * 
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constructor of the object.
   */
  public AdminPass() {
    super();
  }

  /**
   * Destruction of the servlet. <br>
   */
  public void destroy() {
    super.destroy(); // Just puts "destroy" string in log
    // Put your code here
  }

  /**
   * The doGet method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to get.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
			if(tag == 0){
				 session.setAttribute("mess", new Message("restoreMess", "还原成功"));
			}else{
				session.setAttribute("mess", new Message("restoreMess", message+" 还原失败"));
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		response.sendRedirect(servletContext.getContextPath()+"/sadmin/db.jsp");
	}

  }

  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
    // Put your code here
  }

}

public class AdminPass extends HttpServlet {

  /**
   * 
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constructor of the object.
   */

public class ZAdminStageSet extends HttpServlet {

  /**
   * 
   */
  private static final long serialVersionUID = 1L;

  /**
   * Constructor of the object.
   */
  public ZAdminStageSet() {
    super();
  }

  /**
   * Destruction of the servlet. <br>
   */
  public void destroy() {
    super.destroy(); // Just puts "destroy" string in log
    // Put your code here
  }

  /**
   * The doGet method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to get.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    this.doPost(request, response);
  }

  /**
   * The doPost method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to post.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
        request.setAttribute("stuLoginMess", "* 验证码错误!");
        request.getRequestDispatcher("/index.jsp").forward(request, response);
      }else if (stuDao.validateLogin(username, Encrypt.SHA(password)) == null) {
        request.setAttribute("stuLoginMess", "* 用户名或密码输入错误!");
        request.getRequestDispatcher("/index.jsp").forward(request, response);
      }else {
        Record record = new Record();
        record.setLogname(username);
        record.setUsergroup("学生");
        record.setLogip(request.getRemoteAddr());
        if (recordDao.add(record) != 0) {
          session.setAttribute("username", username);
          response.sendRedirect(request.getContextPath() + "/stu/notice.jsp");
        } else {
          request.setAttribute("stuLoginMess", "* 登录异常!");
          request.getRequestDispatcher("/index.jsp").forward(request, response);
        }
      }
    }
  }
  private String validateForm(String username,String password,String code){
    if (username == null || !username.matches("\\w{6,20}")){
      return "* 用户名错误!";
    }else if (password == null || !password.matches("\\w{6,20}")) {
      return "* 密码错误!";
    }else if (code == null || !code.matches("\\d{4}")) {
      return "* 验证码错误!";
    }
    return "";
  }
  
  
  
  
  
  
  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    this.doPost(request, response);
  }

  /**
   * The doPost method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to post.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html; charset=utf-8");
    HttpSession session = request.getSession();
    AdminuserDao adminuserDao = new AdminuserDaoImpl();
    RecordDao recordDao = new RecordDaoImpl();
    
    String adminname = request.getParameter("adminname");
    String adminpass = request.getParameter("adminpass");
    String code = request.getParameter("code");
    
    /*表单数据保存至request作用域*/
    request.setAttribute("adminname", adminname);
    request.setAttribute("adminpass", adminpass);
    request.setAttribute("code", code);
    /*表单数据规范性的服务器端验证*/
    String mess = validateForm(adminname, adminpass, code);
    if (!"".equals(mess)){
      request.setAttribute("adminLoginMess", mess);
      request.getRequestDispatcher("/manage.jsp").forward(request, response);
    }else {
      String sessioncode = session.getAttribute("sessioncode").toString();
      
      if (!code.equals(sessioncode)) {
  public void destroy() {
    super.destroy(); 
  }

  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

   this.doPost(request, response);
  }

 
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html; charset=utf-8");
    ServletContext servletContext = request.getServletContext();
    HttpSession session = request.getSession();
    SchoolDao schoolDao = new SchoolDaoImpl();
    MajorDao majorDao = new MajorDaoImpl();
    CourseDao courseDao = new CourseDaoImpl();
    String action = request.getParameter("action");
    //添加院校基本信息
    if("schoolAdd".equals(action)){
      School school = new School();
      school.setShcode(request.getParameter("shcode"));
      school.setShname(request.getParameter("shname"));
      school.setShaddr(request.getParameter("shaddr"));
      school.setShzip(request.getParameter("shzip"));
      school.setShtel(request.getParameter("shtel"));
      school.setShtest(request.getParameter("shtest"));
      school.setShyear(request.getParameter("shyear"));
      if(schoolDao.add(school) != 0){
        servletContext.setAttribute("school", school);
        session.setAttribute("mess", new Message("schoolAddMess", "学校基本信息设置成功!"));
      }else{
        session.setAttribute("mess", new Message("schoolAddMess", "学校基本信息设置失败!"));
      }
      response.sendRedirect(servletContext.getContextPath()+"/zadmin/release.jsp");
     //添加新的专业
    }else if("majorAdd".equals(action)){
      String mcode = request.getParameter("mcode");
      Major major = new Major();
      major.setMcode(mcode);
      major.setMname(request.getParameter("mname"));
      major.setPlannum(Integer.parseInt(request.getParameter("plannum")));
      if(majorDao.findByMcode(mcode) != null){
        session.setAttribute("mess", new Message("majorAddMess", "专业代码不能重复!"));
      }else if(majorDao.add(major) != 0){
        servletContext.setAttribute("majors", majorDao.findAll());
  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
    // Put your code here
  }

}

public class JAdminRoom extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public JAdminRoom() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
    response.setContentType("text/html; charset=utf-8");
    ServletContext servletContext = request.getServletContext();
    HttpSession session = request.getSession();
    StageDao stageDao = new StageDaoImpl();
    String action = request.getParameter("action");
    
    if ("stageAdd".equals(action)){
      int stagenum = Integer.parseInt(request.getParameter("stagenum").toString());
      Stage stage = new Stage();
      stage.setStagenum(stagenum);
      stage.setStagename(request.getParameter("stagename"));
      stage.setStarttime(request.getParameter("starttime"));
      stage.setEndtime(request.getParameter("endtime"));
      stage.setNote(request.getParameter("note"));
      if(stageDao.findByStagenum(stagenum) != null){
        session.setAttribute("mess", new Message("stageAddMess", "阶段编号不能重复!"));
      }else if(stageDao.add(stage) != 0){
        servletContext.setAttribute("stages", stageDao.findAll());
        session.setAttribute("mess", new Message("stageAddMess", "添加阶段成功!"));
      }else{
        session.setAttribute("mess", new Message("stageAddMess", "添加阶段失败!"));
      }
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp#add");
    //删除系统阶段
    }else if("stageDelete".equals(action)){
      int stagenum = Integer.parseInt(request.getParameter("stagenum").toString());;
      if(stageDao.deleteByStagenum(stagenum) != 0){
        servletContext.setAttribute("stages", stageDao.findAll());
        session.setAttribute("mess", new Message("stageDeleteMess", "阶段删除成功!"));
      }else{
        session.setAttribute("mess", new Message("stageDeleteMess", "阶段删除失败!"));
      }
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp");
    //其他情况
    }else{
      session.removeAttribute("mess");
      response.sendRedirect(servletContext.getContextPath()+"/sadmin/stageadd.jsp");
    }
  }

  /**
   * Initialization of the servlet. <br>
   *
   * @throws ServletException if an error occurs
   */
  public void init() throws ServletException {
    // Put your code here
  }

}

    // Put your code here
  }

  /**
   * The doGet method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to get.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    this.doPost(request, response);
  }

  /**
   * The doPost method of the servlet. <br>
   *
   * This method is called when a form has its tag value method equals to post.
   * 
   * @param request the request send by the client to the server
   * @param response the response send by the server to the client
   * @throws ServletException if an error occurred
   * @throws IOException if an error occurred
   */
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html; charset=utf-8");
    HttpSession session = request.getSession();
    RecordDao recordDao = new RecordDaoImpl();
    int pageSize,pageNo;
    try{
      pageSize = request.getParameter("pageSize") == null ? 10 : Integer.parseInt(request.getParameter("pageSize").toString());
      pageNo = request.getParameter("pageNo") == null ? 1 : Integer.parseInt(request.getParameter("pageNo").toString());
    }catch (NumberFormatException e) {
      pageSize=10;
      pageNo=1;
    }
    String username = (String)session.getAttribute("username");
    PageModel<Record> pm =  recordDao.pageByLogname(username, "学生",pageSize, pageNo);
    pm.setPageNav(request.getRequestURI());
    request.setAttribute("pm", pm);

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java毕业

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值