网页端效果见图,点击图中的红× 达到从购物车移除菜,网页显示session error。
这是引用的方法。
public String delGoodsFromCart(int goodsId) {
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
Cart cart=(Cart)session.getAttribute("cart");
cart.delGoods(goodsId);
session.setAttribute("cart", cart);
return "yes";
}