没装工具,随手写一下。
//获得商品id
String strId = request.getpara..("productId");
int id = Integer.paserInt(strid);
//是否存在购物车
if(session.getAtu...("card") == null) {
   session.setAtt...("card",new HashMap());
}
//拿出购物车中商品
Map products = (Map)session.getAtt..("card");
//检查商品是否已经存在于购物车
Product pro = products.get(id);
//不存在从数据库中查
if(pro == null){
  Product product = new DAO().getProductByid(id);
  map.put(id,product);
} else {
   //存在就数量+1
}大概是这样吧