Example: Session cont...
Associating Information with a Session
HttpSession session = request.getSession(true); session.putValue("referringPage",request.getHeader("Referer"));
ShoppingCart previousItems = (ShoppingCart)session.getValue("previousItems");
if (previousItems == null) { previousItems = new ShoppingCart(...);
String itemID = request.getParameter("itemID"); previousItems.addEntry(Catalog.getEntry(itemID));
// You still have to do putValue, not just modify the cart, since
// the cart may be new and thus not already stored in the session. session.putValue("previousItems", previousItems