jsp+mysql大学校园二手交易平台开发+数据流图+ER图(11)
时间:2017-01-10 13:09 来源:毕业论文 作者:毕业论文 点击:次
request.setAttribute("usernameError", "账号只能是字母或者数字"); valid=false; } if(StringUtils.isEmpty(password)){ request.setAttribute("passwordError", "密码不能为空"); valid=false; }else if(password.length()>20){ request.setAttribute("passwordError", "密码长度不能大于20位"); valid=false; }else if(password.length()<6){ request.setAttribute("passwordError", "密码长度不能小于6位"); valid=false; } if(!valid){ request.getRequestDispatcher("/login.jsp").forward(request, response); return; } UserService userService = new UserService(); try{ User user = userService.getByUsername(username); if(user==null){ throw new MyException("账号不存在"); }else if(!password.equals(user.getPassword())){ throw new MyException("密码不正确"); } HttpSession session = request.getSession(); session.setAttribute("loginUser", user); if("1".equals(user.getIsAdmin())){//管理员 request.getRequestDispatcher("/goodsMsg?operMethod=adminGoodsMsgList").forward(request, response); }else{//普通用户 if("0".equals(user.getStatus())){ String operUrl = request.getParameter("operUrl"); request.setAttribute("operUrl", operUrl); request.getRequestDispatcher("/loginSuccess.jsp").forward(request, response); }else{ throw new MyException("账号已经删除"); } (责任编辑:qin) |