public String save() throws Exception { if (StringUtil.isEmpty(student.getId())) { student.setId("JS" + DateUtil.getCurrentDateStr()); } studentDao.saveStudent(student); return "save"; }
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; }
public String preSave() { if (StringUtil.isEmpty(id)) { title = "添加考生信息"; } else { title = "修改考生信息"; student = studentDao.getStudent(id); } s = "2"; mainPage = "/student/saveStudent.jsp"; return SUCCESS; }