hibernate+struts2 订餐项目

    xiaoxiao2021-03-26  31

    **模拟订餐系统**

    首先:要导入所需要导入的jar 包

    配置好hibernate.cfg.xml 和struts.xml

    我个人包的区分 dao层主要 sql 交互 service层 写业务代码 action层 负责 页面的跳转 util主要写一些常用的工具

    先写实体类(注意提供set get方法)

    配置好对应的 XXX.hbm.xml

    dao层写一个实现接口

    利用Hibernate 实现下面接口增删查改

    然后service层 我也写了接口 为了方面维护

    我在 serviceImp层实现service层 写的业务代码

    然后在action 层 主要负责页面的跳转

    看看页面 注册 登录

    分页功能

    商品详情

    购买的信息

    /** * 购物车 * @return */ public String getGowuc(){ ActionContext act = ActionContext.getContext(); int userId = Integer.parseInt(act.getSession().get(“userId”).toString());

    mcs.addCar(mc);//添加的方法 calist = mcd.selecetMycar(userId);//遍历购买的信息 return "test"; } 一点购买就添加到sql 再把sql里的数据遍历出来 还有一些清空购物车的功能

    订单

    订单历史 添加食谱

    转载请注明原文地址: https://ju.6miu.com/read-350181.html

    最新回复(0)