Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the code of the train ticket booking system realized by Java

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report