Beispiel #1
0
 public void delete() throws Exception {
   student = studentDao.getStudent(id);
   studentDao.delete(student);
   JSONObject result = new JSONObject();
   result.put("success", true);
   ResponseUtil.write(result, ServletActionContext.getResponse());
 }
Beispiel #2
0
 public String list() {
   mainPage = "student/studentList.jsp";
   HttpSession session = request.getSession();
   if (StringUtil.isEmpty(page)) {
     page = "1";
   }
   if (s_student == null) {
     Object o = session.getAttribute("s_student");
     if (o == null) {
       s_student = new Student();
     } else {
       s_student = (Student) o;
       session.setAttribute("s_student", s_student);
     }
   } else {
     session.setAttribute("s_student", s_student);
   }
   int count = studentDao.count(s_student);
   PageBean pb = new PageBean(Integer.parseInt(page), 3);
   pageCode =
       PageUtil.genPagation(
           request.getContextPath() + "/student!list", count, Integer.parseInt(page), 3);
   students = studentDao.list(s_student, pb);
   s = "2";
   return SUCCESS;
 }
Beispiel #3
0
 public String update() {
   Student student1 = studentDao.getStudent(student.getId());
   student1.setPassword(student.getPassword());
   studentDao.saveStudent(student1);
   mainPage = "student/updateSuccess.jsp";
   s = "4";
   return SUCCESS;
 }
Beispiel #4
0
 public String save() throws Exception {
   if (StringUtil.isEmpty(student.getId())) {
     student.setId("JS" + DateUtil.getCurrentDateStr());
   }
   studentDao.saveStudent(student);
   return "save";
 }
Beispiel #5
0
 public String preSave() {
   if (StringUtil.isEmpty(id)) {
     title = "添加考生信息";
   } else {
     title = "修改考生信息";
     student = studentDao.getStudent(id);
   }
   s = "2";
   mainPage = "/student/saveStudent.jsp";
   return SUCCESS;
 }
Beispiel #6
0
 public String login() {
   HttpSession session = request.getSession();
   Student currentUser = studentDao.login(student);
   if (currentUser != null) {
     session.setAttribute("currentUser", currentUser);
     s = "1";
     return SUCCESS;
   } else {
     error = "用户名或密码错误!";
     return ERROR;
   }
 }