javawebJAVAJSP酒店预订系统jsp酒店管理系统jsp民宿预订酒店jsp客房预订系统jsp宾馆客房预订系统
2022/3/21 1:28:42
本文主要是介绍javawebJAVAJSP酒店预订系统jsp酒店管理系统jsp民宿预订酒店jsp客房预订系统jsp宾馆客房预订系统,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
javawebJAVAJSP酒店预订系统jsp酒店管理系统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; } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { doGet(req, resp); }
这篇关于javawebJAVAJSP酒店预订系统jsp酒店管理系统jsp民宿预订酒店jsp客房预订系统jsp宾馆客房预订系统的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-01基于Python+Vue开发的医院门诊预约挂号系统
- 2024-10-01基于Python+Vue开发的旅游景区管理系统
- 2024-10-01RestfulAPI入门指南:打造简单易懂的API接口
- 2024-10-01初学者指南:了解和使用Server Action
- 2024-10-01Server Component入门指南:搭建与配置详解
- 2024-10-01React 中使用 useRequest 实现数据请求
- 2024-10-01使用 golang 将ETH账户的资产平均分散到其他账户
- 2024-10-01JWT用户校验课程:从入门到实践
- 2024-10-01Server Component课程入门指南
- 2024-09-30Dnd-Kit学习:新手快速入门指南