欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Java毕业设计实战之在线蛋糕销售商城的实现

程序员文章站 2022-03-01 13:11:20
一、项目简述功能: 主页显示商品; 所有蛋糕商品展示,可进行商品搜索; 点击商品进入商品详情页,具有立即购买功能,可增减购买商品数量亦可手动输入,热销商品展示。 立即购买进入确认订单页面,可选择已经添...

一、项目简述

功能: 主页显示商品; 所有蛋糕商品展示,可进行商品搜索; 点击商品进入商品详情页,具有立即购买功能,可增减购买商品数量亦可手动输入,热销商品展示。 立即购买进入确认订单页面,可选择已经添加的地址,亦可新增地址。 可选择购买哪些商品,可删除不需要的商品。 点击结算进入确认订单页面,确认后提交订单。后台管理:(修改密码等),商品管理(商品批量添加、上下架等),订单管理。

二、项目运行

环境配置:

jdk1.8 + tomcat8.5 + mysql + eclispe(intellij idea,eclispe,myeclispe,sts都支持)

项目技术:

jsp +springboot+ springmvc + mybatis + thymeleaf + ftp+ javascript + jquery + ajax + maven等等

Java毕业设计实战之在线蛋糕销售商城的实现

Java毕业设计实战之在线蛋糕销售商城的实现

Java毕业设计实战之在线蛋糕销售商城的实现

Java毕业设计实战之在线蛋糕销售商城的实现

Java毕业设计实战之在线蛋糕销售商城的实现

登录控制层:

@webservlet(name = "user_login",urlpatterns = "/user_login")
public class userloginservlet extends httpservlet {
    private userservice uservice = new userservice();
    protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {
        string ue = request.getparameter("ue");
        string password = request.getparameter("password");
        user user = uservice.login(ue, password);
        if(user==null) {
            request.setattribute("failmsg", "用户名、邮箱或者密码错误,请重新登录!");
            request.getrequestdispatcher("/user_login.jsp").forward(request, response);
        }else {
            request.getsession().setattribute("user", user);
            request.getrequestdispatcher("/user_center.jsp").forward(request, response);
        }
    }
 
    protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {
 
    }
}

商品信息列表:

@webservlet(name = "goods_list",urlpatterns = "/goods_list")
public class goodslistservlet extends httpservlet {
    private goodsservice gservice=new goodsservice();
    private typeservice tservice=new typeservice();
    protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {
 
    }
 
    protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {
        int id=0;
        if(request.getparameter("typeid")!=null)
        {
            id=integer.parseint(request.getparameter("typeid"));
        }
        int pagenumber=1;
        if(request.getparameter("pagenumber")!=null) {
            try {
                pagenumber=integer.parseint(request.getparameter("pagenumber"));
            }
            catch (exception e)
            {
 
            }
 
        }
        type t=null;
        if(id!=0)
        {
            t=tservice.selecttypenamebyid(id);
        }
        request.setattribute("t",t);
        //list<goods> list=gservice.selectgoodsbytypeid(id,1,8);
        //request.setattribute("goodslist",list);
        if(pagenumber<=0)
            pagenumber=1;
        page p=gservice.selectpagebytypeid(id,pagenumber);
 
        if(p.gettotalpage()==0)
        {
            p.settotalpage(1);
            p.setpagenumber(1);
        }
        else {
            if(pagenumber>=p.gettotalpage()+1)
            {
                p=gservice.selectpagebytypeid(id,p.gettotalpage());
            }
        }
 
        request.setattribute("p",p);
        request.setattribute("id",string.valueof(id));
        request.getrequestdispatcher("/goods_list.jsp").forward(request,response);
    }
}

管理员订单服务类:

@webservlet(name = "admin_order_list",urlpatterns = "/admin/order_list")
public class adminorderlistservlet extends httpservlet {
    private orderservice oservice = new orderservice();
    /**
     * @see httpservlet#doget(httpservletrequest request, httpservletresponse response)
     */
    protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception {
        int status = 0;
        if(request.getparameter("status") != null) {
            status=integer.parseint(request.getparameter("status") ) ;
        }
        request.setattribute("status", status);
        int pagenumber = 1;
        if(request.getparameter("pagenumber") != null) {
            try {
                pagenumber=integer.parseint(request.getparameter("pagenumber") ) ;
            }
            catch (exception e)
            {
 
            }
        }
        if(pagenumber<=0)
            pagenumber=1;
        page p = oservice.getorderpage(status,pagenumber);
        if(p.gettotalpage()==0)
        {
            p.settotalpage(1);
            p.setpagenumber(1);
        }
        else {
            if(pagenumber>=p.gettotalpage()+1)
            {
                p = oservice.getorderpage(status,pagenumber);
            }
        }
 
        request.setattribute("p", p);
        request.getrequestdispatcher("/admin/order_list.jsp").forward(request, response);
    }
}

到此这篇关于java毕业设计实战之在线蛋糕销售商城的实现的文章就介绍到这了,更多相关java 在线蛋糕销售商城内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!