失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > javawebjsp酒店预订系统 (jsp酒店管理系统jsp民宿预订系统)jsp酒店客房预订系统

javawebjsp酒店预订系统 (jsp酒店管理系统jsp民宿预订系统)jsp酒店客房预订系统

时间:2018-08-23 03:23:29

相关推荐

javawebjsp酒店预订系统 (jsp酒店管理系统jsp民宿预订系统)jsp酒店客房预订系统

javawebjsp酒店预订系统 (jsp酒店管理系统jsp民宿预订系统)jsp酒店客房预订系统

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {JSONObject jsonObject = new JSONObject();String username = req.getParameter("username");String password = req.getParameter("password");resp.setCharacterEncoding("UTF-8");HttpSession session = req.getSession();if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {jsonObject.put("code", 2000);jsonObject.put("flag", "fail");jsonObject.put("user", null);jsonObject.put("msg", "usernameOrPasswordIsBank");//用户名密码不能为空resp.getWriter().print(jsonObject);return;}password = MyMD5Util.encrypt(password);System.out.println(password);BusinessUserVO businessUserVO = new BusinessUserVO();businessUserVO.setUsername(username);businessUserVO.setPassword(password);StudentUserVO studentUserVO = new StudentUserVO();studentUserVO.setUsername(username);studentUserVO.setPassword(password);String flag1 = null;String flag2 = null;try {flag1 = BusinessUserDao.selectUsername(businessUserVO);if ("ok".equals(flag1)) {//企业用户名存在BusinessUserDTO businessUserDTO = BusinessUserDao.select(businessUserVO);if (businessUserDTO != null) {jsonObject.put("code", 2000);jsonObject.put("flag", "success");//登录成功jsonObject.put("user", businessUserDTO);jsonObject.put("msg", "login_success");session.setAttribute("businessUser",businessUserDTO);resp.getWriter().print(jsonObject);return;} else {jsonObject.put("code", 2000);jsonObject.put("flag", "fail");//登录失败jsonObject.put("user", null);jsonObject.put("msg", "passwordError");//密码错误resp.getWriter().print(jsonObject);return;}}flag2 = StudentUserDao.selectUsername(studentUserVO);if ("ok".equals(flag2)) {//学生用户名存在StudentUser studentUser = StudentUserDao.select(studentUserVO);if (studentUser != null) {jsonObject.put("code", 2000);jsonObject.put("flag", "success");//登录成功jsonObject.put("user", studentUser);jsonObject.put("msg", "login_success");session.setAttribute("studentUser",studentUser);resp.getWriter().print(jsonObject);return;} else {jsonObject.put("code", 2000);jsonObject.put("flag", "fail");//登录失败jsonObject.put("user", null);jsonObject.put("msg", "passwordError");//密码错误resp.getWriter().print(jsonObject);return;}}//用户名不存在,前往注册jsonObject.put("code", 2000);jsonObject.put("flag", "fail");//登录失败jsonObject.put("user", null);jsonObject.put("msg", "usernameIsNotExist");//密码错误resp.getWriter().print(jsonObject);return;} catch (SQLException throwables) {throwables.printStackTrace();}return;}@Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {doGet(req, resp);}

如果觉得《javawebjsp酒店预订系统 (jsp酒店管理系统jsp民宿预订系统)jsp酒店客房预订系统》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。