/**
   * 添加一个教师信息
   *
   * @return
   */
  public String addT() throws Exception {

    if (pictureUpload() != null) {
      teacher.setPictureUrl(pictureUpload());
    }
    personService.saveTeacher(teacher);
    request.setAttribute("SUCCESS", "添加教师成功");
    return "addSuccess";
  }
  /**
   * 对教师信息的修改,可以是教师本身或者管理员
   *
   * @return
   */
  public String updateT() {
    init();
    String teacherId = request.getParameter("teacherId"); // 从请求参数过来的是老师更改
    if (teacherId == null) {
      teacherId = request.getSession().getAttribute("USER_ID").toString(); // 从session获得的是老师更改的
    }
    Teacher teacher = personService.getTeacher(teacherId);
    String imageUrl = teacher.getPictureUrl(); // 服务器绝对地址
    if (imageUrl != null) {
      oldPicturePath = imageUrl; // 保存一个地址,用于和更新后的比较是否有变化,有变化就删除原来的图片
      imageUrl = imageUrl.substring(imageUrl.lastIndexOf("\\") + 1);
      String relativeUrl = "File/images/" + imageUrl; // 浏览器相对地址
      teacher.setPictureUrl(relativeUrl);
    }

    request.setAttribute("teacher", teacher);

    return "updateTSuccess";
  }
 /**
  * 处理教师信息的修改
  *
  * @return
  * @throws IOException
  * @throws Exception
  */
 public String updateTDeal() throws Exception {
   init();
   if (pictureUpload() != null) {
     teacher.setPictureUrl(pictureUpload());
     if (oldPicturePath != null) { // 设置了新的图片就删除原来的图片
       File file = new File(oldPicturePath);
       if (file.exists()) {
         file.delete();
       }
     }
   }
   personService.updateTeacher(teacher);
   response.getWriter().write("<script type='text/javascript'> alert('修改教师信息成功')</script>");
   response.flushBuffer();
   response.getWriter().close();
   return NONE;
 }