栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

基于javaweb+jsp的火车票预订系统(java+JDBC+JSP+Servlet+html+mysql)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于javaweb+jsp的火车票预订系统(java+JDBC+JSP+Servlet+html+mysql)

基于javaweb+jsp的火车票预订系统(java+JDBC+JSP+Servlet+html+mysql)
一、项目运行

环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:
JSP + Servlert + html+ css + Javascript + JQuery + Ajax 等等;






适用

课程设计,大作业,毕业设计,项目练习,学习演示等

     * @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","密码修改成功");
                return map;
            }else{
                map.put("type","error");
                map.put("msg","原密码错误");
                return map;
        //查找条件,一定要紧跟在startPage后
        List salaryList = userInforService.getEmployeeSalaryList(eId, year);
        PageInfo pageResult = new PageInfo(salaryList);
        //设置前台需要的数据
        EmployeeSalaryVO employeeSalaryVO = new EmployeeSalaryVO();
        employeeSalaryVO.setCode(0);
        employeeSalaryVO.setMsg("");
        employeeSalaryVO.setCount((int) pageResult.getTotal());
        employeeSalaryVO.setData(pageResult.getList());
        return employeeSalaryVO;
     * @param httpSession
     * @param username
     * @param password
     * @param identifyingcode
     * @return
     */
    @RequestMapping(value = "/adminLogin.do")
    @ResponseBody
    public Message adminLogin(HttpSession httpSession, String username,
                                            String password, String identifyingcode)
    {
        
    	if(StringUtils.isEmpty(username)) {
    		return Message.error("请填写账号");
    	}
    @PostMapping("/query")
    @ResponseBody
    public Map query(@RequestBody User user) {
        List list = userService.query(user);
        Integer count = userService.count(user);
        return MapControl.getInstance().success().page(list, count).getMap();
    }
    //跳转列表页面
    @GetMapping("/list")
    public String list() {
        return "user/list";
    }
}
个人中心Controller:

@Controller
public class UserInforController {
	
    @Autowired
        modelMap.addAttribute("user", user);
        return "user/edit";
    }
    //查询所有
    @PostMapping("/query")
    @ResponseBody
    public Map query(@RequestBody User user) {
        List list = userService.query(user);
        Integer count = userService.count(user);
        return MapControl.getInstance().success().page(list, count).getMap();
    }
    //跳转列表页面
    @GetMapping("/list")
    public String list() {
    public Map delete(String ids) {
        int result = userService.delete(ids);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
    }
    
    @PostMapping("/edit")
    @ResponseBody
    public Map edit(@RequestBody User user) {
        if(StringUtils.isEmpty(user.getUserName())){
            return MapControl.getInstance().error("请填写用户名").getMap();
        }
        if(StringUtils.isEmpty(user.getName())){
            return MapControl.getInstance().error("请填写名称").getMap();
        }
        if(userInforService.updateEmploueeById(id,employee)<=0) {
        	return Message.error("修改信息失败");
        }
       return Message.success();
    }
    
    @RequestMapping("employeeSalaryList.do")
    @ResponseBody
    public EmployeeSalaryVO findSelective(
            @RequestParam(value="page", defaultValue="1")int pageNum,
            @RequestParam(value="limit", defaultValue="10") int limit,
    @PostMapping("/delete")
    @ResponseBody
    public Map delete(String ids) {
        int result = userService.delete(ids);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
    }
    
    @RequestMapping("changeEmployeePassword.do")
    @ResponseBody
}
个人中心Controller:

@Controller
public class UserInforController {
	
    @Autowired
    private UserInforServiceImpl userInforService = null;
    
    @RequestMapping("changePassword.do")
    @ResponseBody
    public Map changePassword(String oldPassword, String newPassword,
                                              String rePassword, HttpSession httpSession){
        HashMap map = new HashMap();
        if (newPassword.equals(rePassword)){
    @PostMapping("/delete/{id}")
    @ResponseBody
    public Map delete(@PathVariable("id") Integer id) {
        int result = userService.delete(id);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
    }
    //批量删除
    @PostMapping("/delete")
    @ResponseBody
    public Map delete(String ids) {
        PageHelper.startPage(pageNum,limit);
        //查找条件,一定要紧跟在startPage后
        List salaryList = userInforService.getEmployeeSalaryList(eId, year);
        PageInfo pageResult = new PageInfo(salaryList);
        //设置前台需要的数据
        EmployeeSalaryVO employeeSalaryVO = new EmployeeSalaryVO();
        employeeSalaryVO.setCode(0);
        employeeSalaryVO.setMsg("");
        employeeSalaryVO.setCount((int) pageResult.getTotal());
        employeeSalaryVO.setData(pageResult.getList());
        return employeeSalaryVO;
    }
}
管理员和员工登陆控制:

@Controller
        return MapControl.getInstance().success().getMap();
    }
    //批量删除
    @PostMapping("/delete")
    @ResponseBody
    public Map delete(String ids) {
        int result = userService.delete(ids);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();
        }
        return MapControl.getInstance().success().getMap();
}
用户管理操作: 

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    
    @GetMapping("/add")
    public String create() {
        return "user/add";
    }
    
    @RequestMapping(value = "/employeeLogin.do")
    @ResponseBody
    public Message employeeLogin(HttpSession httpSession, String username,
            }
        }else{
            map.put("type","error");
            map.put("msg","两次密码不一致");
            return map;
        }
    }
    
    @RequestMapping("inforEmployee.do")
    public @ResponseBody EmployeeCustomVo getInforEmployee(HttpSession httpSession){
        Integer id = (Integer) httpSession.getAttribute("employeeId");
        EmployeeCustomVo employeeCustomVo = userInforService.getInforEmployee(id);
        return employeeCustomVo;
    @RequestMapping("/")
    public String getLoginPage(){
        return "employee/login.html";
    }
    // 获取管理员登陆界面
    @RequestMapping("/admin.do")
    public String getAdminLoginPage(HttpServletRequest request){
    	String realPath = request.getServletContext().getRealPath("/");
    	request.getSession().setAttribute("realPath", realPath);
        return "admin/adminLogin.html";
    }
    
    
    
    @RequestMapping(value = "/employeeLogin.do")
    @ResponseBody
     * @return
     */
    @GetMapping("/add")
    public String create() {
        return "user/add";
    }
    
    @PostMapping("/add")
    @ResponseBody
    public Map add(@RequestBody User user) {
        if(StringUtils.isEmpty(user.getUserName())){
            return MapControl.getInstance().error("请填写用户名").getMap();
        }
        if(StringUtils.isEmpty(user.getName())){
            return MapControl.getInstance().error("请填写名称").getMap();
        }
        if(StringUtils.isEmpty(user.getUserPwd())){
            return MapControl.getInstance().error("请填写密码").getMap();
        }
    @RequestMapping(value = "/changeCode.do")
    @ResponseBody
    public void getIdentifyingCode(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        // 验证码存储在session的identifyingCode,属性中
        CaptchaUtil.outputCaptcha(request, response);
    }
    // 获取员工登陆界面
    @RequestMapping("/")
    public String getLoginPage(){
        return "employee/login.html";
    }
    // 获取管理员登陆界面
    @RequestMapping("/admin.do")
    public String getAdminLoginPage(HttpServletRequest request){
    	String realPath = request.getServletContext().getRealPath("/");
    	request.getSession().setAttribute("realPath", realPath);
管理员和员工登陆控制:

@Controller
public class LoginController {
    @Autowired
    private LoginServiceImpl loginService = null;
    
    @RequestMapping(value = "/changeCode.do")
    @ResponseBody
        }
    }
    
    
@Controller
public class LoginController {
    @Autowired
    private LoginServiceImpl loginService = null;
    
    @PostMapping("/delete/{id}")
    @ResponseBody
    public Map delete(@PathVariable("id") Integer id) {
        int result = userService.delete(id);
        if (result <= 0) {
            return MapControl.getInstance().error().getMap();

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/781148.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号