ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:702.99KB ,
资源ID:16846344      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16846344.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(JavaWebSSM超市管理系统Word文档下载推荐.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

JavaWebSSM超市管理系统Word文档下载推荐.docx

1、DAO 层的数据源和数据库连接的参数都是在配置文件中进行配置的。2、Entity层: 实体层 数据库在项目中的类3、Service层:业务层 控制业务Service层主要负责业务模块的逻辑应用设计。和DAO层一样都是先设计放接口的类,再创建实现的类,然后在配置文件中进行配置其实现的关联。接下来就可以在service层调用接口进行业务逻辑应用的处理。封装Service层的业务逻辑有利于业务逻辑的独立性和重复利用性。4、Controller层: 控制层 控制业务逻辑Controller层负责具体的业务模块流程的控制,其实就是与前台互交,把前台传进来的参数进行处理,controller层主要调用Se

2、rvice层里面的接口控制具体的业务流程,控制的配置也需要在配置文件中进行。四、概要设计Goods表Goods_user表已存储的商品信息表五、项目实现Controller层商品实现代码:用户实现代码:Dao层对应的mapper文件对应的实体:Service层:controller层:Goods:package com.controller;import java.util.List;import javax.servlet.http.HttpServletRequest;import org.springframework.beans.factory.annotation.Autowired

3、;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Goods;import com.service.GoodsService;ControllerRequestMapping(/goods)public class GoodsController Autowired private GoodsService goodsService; public GoodsService getGoo

4、dsService() return goodsService; public void setGoodsService(GoodsService goodsService) this.goodsService = goodsService; RequestMapping(/selectAll public String selectAll(HttpServletRequest request) throws Exception List goods = goodsService.selectAll(); request.setAttribute(goods, goods); return f

5、orward:/product/productlist.jsp;/save public String save(Goods goods) goodsService.save(goods);/goods/selectAll.do/delete) public String delete(Integer id) throws Exception goodsService.delete(id);/selectByID public String selectByID(Integer id,HttpServletRequest request) Goods goods = goodsService.

6、selectByID(id);/product/update.jsp/updateGoods public String updateGoods(Goods goods) System.out.println(goods); goodsService.updateGoods(goods);User:import javax.servlet.http.HttpSession;import com.entity.User;import com.service.UserService;/userpublic class UserController private UserService userS

7、ervice; public UserService getUserService() return userService; public void setUserService(UserService userService) this.userService = userService; /注册/register) /接受数据 public String register(User user) throws Exception /调用Service 中的注册功能 userService.register(user); /跳转器/user/login.html /登录/login publ

8、ic String login(String user_name,String password,HttpSession session) throws Exception User user = userService.login(user_name, password); if(user!=null) session.setAttribute(name, user.getUser_name(); String name = (String)session.getAttribute(); System.out.println(name); /跳转页面 return else dao层pack

9、age com.dao;public interface GoodsDAO /查询所有商品 public List selectAll(); /添加商品 public void save(Goods goods); /删除商品 public void delete(Integer id); /通过ID查询 public Goods selectByID(Integer id); /修改商品信息 public void updateGoods(Goods goods);对应mapper文件!DOCTYPE mapper PUBLIC -/mybatis.org/DTD Mapper 3.0/EN

10、 ./mybatis-3-mapper.dtd mapper namespace=com.dao.GoodsDAO selectByID select * from goods where id=#idinsert id=save insert into goods(id,name,price,description) values(#id,#name,#price,#description)/insertdelete id=delete delete from goods where id=#id /deleteupdate id=updateGoods update goodsset pr

11、ice! price=#price,description description=#description where id =#id/set/update/mapperimport org.apache.ibatis.annotations.Param;public interface UserDAO /插入一条数据 public void save(User user); /通过user_name和password查询 public User selectByUsernameAndPassword(Param(u)String user_name,Param(p)String passw

12、ord);com.dao.UserDAO insert into goods_user (user_name,name,age,password,sex) values(#user_name,#name,#age,#password,#sex)selectByUsernameAndPasswordUser select * from goods_user where user_name=#u and password=#pEntity层:goods:package com.entity;public class Goods private Integer id; private String

13、name; private double price; private String description; public Integer getId() return id; public void setId(Integer id) this.id = id; public String getName() return name; public void setName(String name) this.name = name; public double getPrice() return price; public void setPrice(double price) this

14、.price = price; public String getDescription() return description; public void setDescription(String description) this.description = description; public Goods(Integer id, String name, double price, String description) public Goods() super(); / TODO Auto-generated constructor stub Override public Str

15、ing toString() Goods id= + id + , name= + name + , price= + price + , description= + description + public class User private String user_name; private int age; private String password; private String sex; public String getUser_name() return user_name; public void setUser_name(String user_name) this.

16、user_name = user_name; public int getAge() return age; public void setAge(int age) this.age = age; public String getPassword() return password; public void setPassword(String password) this.password = password; public String getSex() return sex; public void setSex(String sex) this.sex = sex; public

17、User(String user_name, String name, int age, String password, String sex) public User() User user_name= + user_name + , age= + age + , password= + password + , sex= + sex + service层package com.service;public interface GoodsService /增加商品 /修改对应服务层接口:import org.springframework.stereotype.Service;import

18、 org.springframework.transaction.annotation.Propagation;import org.springframework.transaction.annotation.Transactional;import com.dao.GoodsDAO;ServiceTransactionalpublic class GoodsServiceImpl implements GoodsService private GoodsDAO goodsDAO; public GoodsDAO getGoodsDAO() return goodsDAO; public void setGoodsDAO(GoodsDAO goodsDAO) this.goodsDAO = goodsDAO; /提高查询效率 Transactional(propagation=Propagation.SUPPORTS,readOnly=true) selectAll() goods = goodsDAO.selectAll(); return goods; public void save(Goods goods) goodsDAO.save(goods); publi

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1