Beispiel #1
0
  public String update() {
    ActionContext.getContext().getSession().remove("updateUser");
    if (!checkUser()) {
      this.user = userService.findUserByName(user.getUsername()); // 通过用户名查找用户
      if (user != null) {
        user.setEnabled(this.enabled); // 设置查找出来用户的激活性
        user.setDescription(this.description); // 设置查找出来的用户的描述信息
        user.setPassword(this.repassword); // 设置查找出来的用户的密码

        user = userService.changePassword(user); // 修改用户信息
        if (user != null) {
          msg = "修改成功!";
        } else {
          msg = "修改失败!";
        }
      }
    }

    ActionContext.getContext().getSession().put("msg", msg);
    ActionContext.getContext().getSession().put("userAction", 2); // userAction:2 表示修改用户信息
    return SUCCESS;
  }