petstore中就有一个shoppingcart,使用了EJB中的statefull session bean.
每个用户点按商品时,将该商品保存到该用户的session中,用户离开结账时,再从seesion中获取该用户购买商品的清单。
People do usually use httpSession id ( thru coookie or URL rewrite) to identify unauthenticated client, after you login, they will switch to your user id.
Cheers
-Wanchun
Sorry, I did not understand your question.
那么会把B加入SESSION,这么不是b覆盖了a?
session.setAttribute("shop","a");
session.setAttribute("shop","b");
Vector放入session中,
Vector shopVec=new Vector();
shopVec.addElement(a);
shopVec.addElement(b);
应该可以的;