//把商品放入购物车中
@RemoteMethod
public void addLampToCart(Integer lampId){
List<LampVo> list = (List)ActionContext.getContext().getSession().get("listLamps");
System.out.println("-----------"+list.size());
if(list.size() == 0){
list = new ArrayList<LampVo>();
}
LampVo lampVo = lampService.detailsLamp(lampId);
list.add(lampVo);
ActionContext.getContext().getSession().put("listLamps", list);
}
为什么运行起来就是不行啊....
List<LampVo> list = (List)ActionContext.getContext().getSession().get("listLamps");这句有问题...请高手指教啊??
@RemoteMethod
public void addLampToCart(Integer lampId){
List<LampVo> list = (List)ActionContext.getContext().getSession().get("listLamps");
System.out.println("-----------"+list.size());
if(list.size() == 0){
list = new ArrayList<LampVo>();
}
LampVo lampVo = lampService.detailsLamp(lampId);
list.add(lampVo);
ActionContext.getContext().getSession().put("listLamps", list);
}
为什么运行起来就是不行啊....
List<LampVo> list = (List)ActionContext.getContext().getSession().get("listLamps");这句有问题...请高手指教啊??
Map<String,Object> shoppingCat=ActionContext.getContext().getSession().get("listLamps");
if(shoppingCat!=null)
shoppingCat=new HashMap<String,Object>();在java代码中获取一个Session是一个Map类型的
获得session之后 有get方法 这个方法的方法值 可以是楼主添加进去的 list集合
试下这个试试