I have built a small webshop. When a user puts something in his/her cart, a database action follows, to make sure that the item is no longer available to other shoppers. I'm doing this because each item is unique. When the user leaves the site, the session expires after half an hour. When that happens I want to "empty the cart", i.e. make the items in the cart available again.
I have created a CartWrapper object that holds a Cart and implements HttpSessionListener. The sessiondestroyed method looks like this:
I think this is a dead end, because the forward method takes a HttpServletRequest and a HttpServletResponse as arguments and I don't have those in this class. Can anyone think of some sort of an alternative?
At first I just made CartWrapper go directly to the database but I think that is a little disgusting since I already have
servlets doing all those database actions.
[ January 03, 2005: Message edited by: Rosie Vogel ]