public String save() throws Exception { Student student = new Student(); student.setUsername(this.username); student.setStuid(this.stuid); student.setPhone(this.phone); student.setEmail(this.email); student.setAddress(this.address); ss.save(student); return null; }
public String change() throws Exception { System.out.println("********change*********"); Student student = new Student(); student.setUsername(this.username); student.setStuid(this.stuid); student.setPhone(this.phone); student.setEmail(this.email); student.setAddress(this.address); student.setId(this.id); ss.update(student); return null; }
public String queryById() throws Exception { System.out.println(">>>>>>>>>id=" + this.getId()); Student student = ss.queryById(this.getId()); JSONObject json = new JSONObject(); json.accumulate("student", student); System.out.println(">>>>>>>json=" + json); HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/x-json;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().print(json.toString()); return null; }
public String queryAll() throws Exception { System.out.println("********queryAll********"); List<Student> list = ss.queryAll(); JSONObject json = new JSONObject(); json.accumulate("Rows", list); System.out.println(">>>>>>>>>>json" + json); HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/x-json;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().print(json.toString()); return null; }
public String del() throws Exception { System.out.println(">>>>>>>>del>>>>>>>"); System.out.println(">>>>>>>>>id=" + this.getId()); ss.del(this.getId()); return null; }