Exemplo n.º 1
0
  // 修改学院信息
  private void edit(HttpServletRequest request, HttpServletResponse response) throws IOException {
    PrintWriter out = response.getWriter();
    JsonBean j = new JsonBean();
    int id = Integer.parseInt(request.getParameter("id"));
    int college_num = Integer.parseInt(request.getParameter("college_num"));
    int college_state = Integer.parseInt(request.getParameter("college_state"));
    String college_name = request.getParameter("college_name");

    College co = new College();
    co.setCollege_name(college_name);
    co.setCollege_num(college_num);
    co.setCollege_state(college_state);
    co.setId(id);

    if (service.edit(co)) {
      j.setSuccess(true);
      j.setMsg("修改[" + college_name + "]成功!");
    } else {
      j.setMsg("修改[" + college_name + "]失败!");
    }

    JSONArray jsonArray = new JSONArray().fromObject(j);
    String jsonS = jsonArray.toString();
    String json = jsonS.substring(1, jsonS.lastIndexOf("]"));
    out.write(json);
  }
Exemplo n.º 2
0
  // 删除学院
  private void del(HttpServletRequest request, HttpServletResponse response) throws IOException {
    PrintWriter out = response.getWriter();
    JsonBean j = new JsonBean();
    String ids = request.getParameter("ids");

    service.del(ids);
    j.setSuccess(true);

    JSONArray jsonArray = new JSONArray().fromObject(j);
    String jsonS = jsonArray.toString();
    String json = jsonS.substring(1, jsonS.lastIndexOf("]"));
    out.write(json);
  }