基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)

基于servlet+jsp+jdbc的后台管理系统,包含5个模块:汽车账户部管理、租车账户部管理、汽车信息管理表、租车记录表、租车租聘表。功能完整,均能实现增删查改。
运行环境:
jdk8+tomcat8.5+mysql5.7+Eclipse
项目技术:
servlet+jsp+jdbc+easyui+jquery基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第1张图片
基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第2张图片
基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第3张图片
基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第4张图片
基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第5张图片
基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第6张图片

适用

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

                    Collections.sort(c.getProducts(), new ProductReviewComparator());
                    break;
                case "date":
                    Collections.sort(c.getProducts(), new ProductDateComparator());
                    break;
                case "saleCount":
                    Collections.sort(c.getProducts(), new ProductSaleCountComparator());
                    break;
                case "price":
                    Collections.sort(c.getProducts(), new ProductPriceComparator());
                    break;
                case "all":
                    Collections.sort(c.getProducts(), new ProductAllComparator());
                    break;
            }
        }
        // 排序完成后,将分类对象添加到域对象 request 中
        request.setAttribute("c", c);
        return "category.jsp";
    }
    /**
        // 判断用户名是否存在
        boolean exist = userDAO.isExists(name);
        if (exist) {
            request.setAttribute("msg", "用户名已经被使用");
            return "register.jsp";
        }
        User user = new User();
        user.setName(name);
        user.setPassword(password);
        System.out.println(user.getName());
        System.out.println(user.getPassword());
        userDAO.add(user);
        return "@registerSuccess.jsp";
    }
    /**
     * 登录
     *
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String login(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了 ForeServlet login方法");
        Map<String, String> params = new HashMap<>();
        InputStream inputStream = super.parseUpload(request, params);
    /**
     * 立即购买
     *
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String buyone(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了ForeServlet buyone方法");
        int pid = Integer.parseInt(request.getParameter("pid"));
        int num = Integer.parseInt(request.getParameter("num"));
        Product p = productDAO.get(pid);
        User user = (User) request.getSession().getAttribute("user");
        List<OrderItem> ois = orderItemDAO.listByUser(user.getId());
        int oiid = 0;
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
DOCTYPE html>
<html>
<head>
	<title>用户登录title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.css">
	<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css">
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js">script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js">script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/simpleCart.min.js">script>
head>
<body>
	
	
	<jsp:include page="header.jsp">
		<jsp:param name="flag" value="9">jsp:param>
	jsp:include>
	
    }
    /**
     * 加入购物车
     *
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String addCart(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了ForeServlet addCart方法");
        int pid = Integer.parseInt(request.getParameter("pid"));
        int num = Integer.parseInt(request.getParameter("num"));
        Product p = productDAO.get(pid);
        User user = (User) request.getSession().getAttribute("user");
        List<OrderItem> ois = orderItemDAO.listByUser(user.getId());
        int oiid = 0;
        boolean found = false;
        // 遍历订单,如果订单已存在对应的产品,就在对应购物车的基础上调整数量
        if (null != ois) {
            for (OrderItem oi : ois) {
                if (oi.getProduct().getId() == p.getId()) {
                    oi.setNumber(oi.getNumber() + num);
                    orderItemDAO.update(oi);
                    found = true;
                    oiid = oi.getId();
                    break;
        int pid = Integer.parseInt(request.getParameter("pid"));
        Product p = productDAO.get(pid);
        // 获取产品的single图片和detail图片
        List<ProductImage> productSingleImages = productImageDAO.list(p, ProductImageDAO.type_single);
        List<ProductImage> productDetailImages = productImageDAO.list(p, ProductImageDAO.type_detail);
        p.setProductSingleImages(productSingleImages);
        p.setProductDetailImages(productDetailImages);
        //p.setFirstProductImage(productSingleImages.get(0));
        // 获取产品属性信息
        List<PropertyValue> pvs = propertyValueDAO.list(p.getId());
        // 获取产品评价信息
        List<Review> reviews = reviewDAO.list(p.getId());
        // 设置产品销量数和评价数
        productDAO.setSaleAndReviewNumber(p);
        request.setAttribute("p", p);
        request.setAttribute("pvs", pvs);
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String loginAjax(HttpServletRequest request, HttpServletResponse response, Page page) {
        String name = request.getParameter("name");
        String password = request.getParameter("password");
        User user = userDAO.get(name, password);
        if (user == null)
            return "%fail";
        request.getSession().setAttribute("user", user);
        return "%success";
    }
    /**
     * 显示产品页
     *
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String product(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了 ForeServlet product方法");
        int pid = Integer.parseInt(request.getParameter("pid"));
        int cid = Integer.parseInt(request.getParameter("cid"));
        // 获取分类对象并为填充产品对象、销量、评价
        Category c = new CategoryDAO().get(cid);
        new ProductDAO().fill(c);
        new ProductDAO().setSaleAndReviewNumber(c.getProducts());
        // 根据获取的排序方式进行排序
        String sort = request.getParameter("sort");
        if (null != sort) {
            switch (sort) {
                case "review":
                    Collections.sort(c.getProducts(), new ProductReviewComparator());
                    break;
                case "date":
                    Collections.sort(c.getProducts(), new ProductDateComparator());
                    break;
                case "saleCount":
                    Collections.sort(c.getProducts(), new ProductSaleCountComparator());
     *
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String product(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了 ForeServlet product方法");
        int pid = Integer.parseInt(request.getParameter("pid"));
        Product p = productDAO.get(pid);
        // 获取产品的single图片和detail图片
        List<ProductImage> productSingleImages = productImageDAO.list(p, ProductImageDAO.type_single);
        List<ProductImage> productDetailImages = productImageDAO.list(p, ProductImageDAO.type_detail);
        p.setProductSingleImages(productSingleImages);
        p.setProductDetailImages(productDetailImages);
        //p.setFirstProductImage(productSingleImages.get(0));
        // 获取产品属性信息
        List<PropertyValue> pvs = propertyValueDAO.list(p.getId());
        // 获取产品评价信息
        List<Review> reviews = reviewDAO.list(p.getId());
        // 设置产品销量数和评价数
        productDAO.setSaleAndReviewNumber(p);
        request.setAttribute("p", p);
        request.setAttribute("pvs", pvs);
    public String alipay(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了ForeServlet alipay方法");
        return "alipay.jsp";
    }
    /**
     * 支付完成界面
     * @param request
     * @param response
     * @param page
     * @return
     */
    public String payed(HttpServletRequest request, HttpServletResponse response, Page page) {
        System.out.println("调用了ForeServlet payed方法");
        int oid = Integer.parseInt(request.getParameter("oid"));
        Order order = orderDAO.get(oid);
        order.setStatus(OrderDAO.waitDelivery);
        order.setPayDate(new Date());
        orderDAO.update(order);
        request.setAttribute("o", order);
        return "payed.jsp";
    }
    /**
     * 我的订单页面

基于javaweb+mysql的共享租车信息管理系统(java+Jsp+Servlet+Jdbc+Mysql)_第7张图片

你可能感兴趣的:(java,mysql,easyui)