星空网 > 软件开发 > Java

网上商城3

1.创建表:(一级分类)

CREATE TABLE `category` ( `cid` int(11) NOT NULL AUTO_INCREMENT, `cname` varchar(255) DEFAULT NULL, PRIMARY KEY (`cid`)) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;INSERT INTO `category` VALUES ('1', '女装男装');INSERT INTO `category` VALUES ('2', '鞋靴箱包');INSERT INTO `category` VALUES ('3', '运动户外');INSERT INTO `category` VALUES ('4', '珠宝配饰');INSERT INTO `category` VALUES ('5', '手机数码');INSERT INTO `category` VALUES ('6', '家电办公');INSERT INTO `category` VALUES ('7', '护肤彩妆');

 

2.首页上的查询所有一级分类

IndexAction

@Override/** * 访问首页的时候执行的方法: */public String execute() throws Exception {	// 查询所有一级分类	List<Category> cList = categoryService.findAll();	// 查询热门商品:	List<Product> hList = productService.findByHot();	// 查询最新商品:	List<Product> nList = productService.findByNew();	// 存入到值栈:	// 获得值栈:	ValueStack stack = ActionContext.getContext().getValueStack();	// stack.set("cList", cList);	ActionContext.getContext().getSession().put("cList", cList);	stack.set("hList", hList);	stack.set("nList", nList);	return "index";}

网上商城3

 




原标题:网上商城3

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流