资源简介
网上商城WEB开发,其中包括用户注册登录界面,以及商城商品显示界面,购物车管理界面,以及支付界面,当商品数量发生变化时会及时反馈到商城页面......订单管理界面含开发文档,数据库源码,演示截图,导入即可运行
代码片段和文件信息
package com.aaa.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.aaa.service.ICartService;
import com.aaa.vo.Cart;
import com.aaa.vo.User;
import com.util.Constants;
@Controller
@RequestMapping(“/cart“)
public class CartController {
@Resource
private ICartService cartService;
@RequestMapping(“/toCartList“)
public String toCartList(){
return “cart/cartList“;
}
@RequestMapping(“/addCart“)
public String addCart(Cart cartHttpSession sessionModel model){
//User user=(User)session.getAttribute(Constants.USER_SESSION);
User user=new User();
user.setUid(1);
//将目前存在的用户id,放到cart里
cart.setUid(user.getUid());
if(null==user){
//未登陆状态操作
System.out.println(“==“);
}else{
//登录状态
cartService.addCart(cart);
List selectOne=cartService.selectByUid(user.getUid());
model.addAttribute(“cartList“selectOne);
}
return “cart/cartList“;
}
@RequestMapping(“/selectById“)
public String selectById(Cart cartModel model){
List selectOne = cartService.selectOne(cart);
model.addAttribute(“cartList“ selectOne);
return “cart/cartList“;
}
@RequestMapping(“/select“)
public String select(Model model){
cartService.select();
List select = cartService.select();
model.addAttribute(“cartList“ select);
return “cart/cartList“;
}
@RequestMapping(“/{id}/deleteById“)
public String deleteById(@PathVariable int id){
cartService.deleteById(id);
return “redirect:/cart/select“;
}
}
- 上一篇:基于B/S的javaweb在线手机网上商城
- 下一篇:jfinal运行所需jar包
评论
共有 条评论