>1. Store your cart in session, and when that all works. For everyone. 
>Gets to the checkout and funds are exchanged.

While I agree with the previous posters who said that it would make your
life easier if you can require login, if you absolutely need to save
carts of users regardless of login status, you might consider having
your Cart object impelment
javax.servlet.http.HttpSessionBindingListener.  Objects implementing
this interface are notified when they are bound to or unbound from
(either explicitly or by the session itself expiring/invalidated) a
session, and can perform tasks at these times.

In your case, when your Cart object is unbound you would save its
contents to your database.  (Conversely, when you first bind a Cart
object to a session, you can check the database and refresh its
contents, if any.)  Nothing about this approach prohibits you from
saving Cart information at other appropriate times -- user logins,
purchases, and the like -- this approach just allows you the ability to
store information, like cart contents, at the end of a client session.

-Greg



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to