How to write the code of the train ticket booking system realized by Java
In this article, the editor introduces in detail "how to write the code of the train ticket booking system in Java". The content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to write the code of the train ticket booking system in Java" can help you solve your doubts.
I. Project operation
Environment configuration:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe (both supported by IntelliJ IDEA,Eclispe,MyEclispe,Sts)
Project technology:
JSP + Servlert + html+ css + JavaScript + JQuery + Ajax etc.
Second, the effect picture
Core Code personal Center Controller/** * personal Center Controller * / @ Controllerpublic class UserInforController {@ Autowired private UserInforServiceImpl userInforService = null / * change password operation * @ param oldPassword * @ param newPassword * @ param rePassword * @ param httpSession * @ return * / @ RequestMapping ("changePassword.do") @ ResponseBody public Map changePassword (String oldPassword, String newPassword, String rePassword, HttpSession httpSession) {HashMap map = new HashMap () If (newPassword.equals (rePassword)) {SystemManager admin = (SystemManager) httpSession.getAttribute ("admin"); String encodeByMD5 = MD5Utils.encodeByMD5 (oldPassword); if (encodeByMD5.equals (admin.getSmPassword () {String newPasswords = MD5Utils.encodeByMD5 (newPassword); admin.setSmPassword (newPasswords); userInforService.updateSystemManagePassword (admin.getSmId (), admin) Map.put ("type", "success"); map.put ("msg", "password modified successfully"); return map;} else {map.put ("type", "error"); map.put ("msg", "original password error"); return map }} else {map.put ("type", "error"); map.put ("msg", "password inconsistency"); return map }} / * employees change their personal password * @ param oldPassword * @ param newPassword * @ param rePassword * @ param httpSession * @ return * / @ RequestMapping ("changeEmployeePassword.do") @ ResponseBody public Map changeEmployeePassword (String oldPassword, String newPassword, String rePassword) HttpSession httpSession) {HashMap map = new HashMap () If (newPassword.equals (rePassword)) {Integer eid = (Integer) httpSession.getAttribute ("employeeId"); try {userInforService.updateEmployeePassword (eid, oldPassword, newPassword); map.put ("type", "success"); map.put ("msg", "password changed successfully"); return map } catch (CustomException e) {map.put ("type", "error"); map.put ("msg", "original password error"); return map;}} else {map.put ("type", "error"); map.put ("msg", "password inconsistency") Return map;}} / * View personal information * @ param httpSession * @ return * / @ RequestMapping ("inforEmployee.do") public @ ResponseBody EmployeeCustomVo getInforEmployee (HttpSession httpSession) {Integer id = (Integer) httpSession.getAttribute ("employeeId"); EmployeeCustomVo employeeCustomVo = userInforService.getInforEmployee (id); return employeeCustomVo } / * modify personal information * @ param httpSession * @ param employee * @ return * / @ ResponseBody @ RequestMapping ("updateInforEmployee.do") public Message updateInforEmployee (HttpSession httpSession, Employee employee) {Integer id = (Integer) httpSession.getAttribute ("employeeId"); employee.seteId (id); if (userInforService.updateEmploueeById (id,employee)