save.jsp
上传用户:zaktkj
上传日期:2022-08-08
资源大小:5770k
文件大小:1k
源码类别:

JavaScript

开发平台:

JavaScript

  1. <%@ page contentType="application/json;charset=utf-8" import="com.family168.student.*" %><%
  2.     request.setCharacterEncoding("utf-8");
  3.     response.setCharacterEncoding("utf-8");
  4.     String id = request.getParameter("id");
  5.     String code = request.getParameter("code");
  6.     String name = request.getParameter("name");
  7.     String sex = request.getParameter("sex");
  8.     String age = request.getParameter("age");
  9.     String political = request.getParameter("political");
  10.     String origin = request.getParameter("origin");
  11.     String professional = request.getParameter("professional");
  12.     Student student = new Student();
  13.     student.setCode(code);
  14.     student.setName(name);
  15.     student.setSex(Integer.parseInt(sex));
  16.     student.setAge(Integer.parseInt(age));
  17.     student.setPolitical(political);
  18.     student.setOrigin(origin);
  19.     student.setProfessional(professional);
  20.     StudentDao dao = StudentDao.getInstance();
  21.     if (id == null || id.equals("")) {
  22.         dao.insert(student);
  23.     } else {
  24.         student.setId(Long.parseLong(id));
  25.         dao.update(student);
  26.     }
  27.     out.print("{success:true,msg:'保存成功'}");
  28. %>