public String execute() throws Exception { // TODO Auto-generated method stub Users condition = new Users(); condition.setLoginName(loginName); condition.setLoginPwd(loginPwd); List list = userBiz.login(condition); if (list.size() > 0) { Users users = (Users) list.get(0); String name = users.getName(); Integer roleId = users.getRoleId(); Map<String, Object> session = ActionContext.getContext().getSession(); session.put("name", name); session.put("role", roleId); return ActionSupport.SUCCESS; } else { return "error"; } }
public String addUser() throws Exception { userBiz.register(users); System.out.println("前端註冊名字為" + users.getLoginName()); return "success"; }