@RequestMapping(value = "/add", method = RequestMethod.POST) public JSONObject add(@ModelAttribute("user") User user) { JSONObject json = new JSONObject(); try { user.setPassword(PwdUtil.md5(user.getUsername() + user.getPassword())); userBiz.save(user); json.put("err", 0); json.put("msg", "保存成功,成功后的ID为:" + user.getId()); } catch (Exception e) { json.put("err", 1); json.put("msg", "保存失败!"); Constans.LOG.error(e); } return json; }
public String execute() { IUserDAO iuserdao = new UserDAO(); nonveList = new ArrayList<User>(); veList = new ArrayList<User>(); managerlist = iuserdao.findByActor(Actor.MANAGER); User manager = new User(); for (int i = 0; i < managerlist.size(); i++) { manager = managerlist.get(i); if (manager.getVerification().equals("0")) { nonveList.add(manager); } else { veList.add(manager); } } return "toTrue"; }
@RequestMapping(value = "adduser.htm", method = RequestMethod.POST) public String registerUser(@ModelAttribute("RegisterUser") User user, Model model) { regdao.addUser( regdao.maxKey("User", "user_id") + 1, user.getUsername(), user.getFirst_name(), user.getLast_name(), user.getProfile_pic(), user.getEmail(), user.getPassword()); return "Register"; }
@RequestMapping("chat") public String view(ModelMap model, HttpServletRequest request) throws Exception { User loginUser = this.getLoginUser(request.getSession()); model.addAttribute("key", loginUser == null ? this.getIp(request) : loginUser.getId()); return "chat/view"; }