wood burning stoves*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes shopping cart or shopping memo? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "shopping cart or shopping memo?" Watch "shopping cart or shopping memo?" New topic
Author

shopping cart or shopping memo?

Joseph Zhou
Ranch Hand

Joined: Aug 01, 2000
Posts: 129
Most of the time, the online shopping cart is just a shopping memo, you put something in your shopping cart doesn't means you hold the the stuff other body cannot touch(keep long transaction is not good). any comments about booking the seats?
Annie Zhang
Ranch Hand

Joined: Sep 08, 2004
Posts: 31
If you don't persist the shopping cart, then others cannot "touch" your cart, unless you specifically develop some way to let others "touch" it.
The shopping cart is valid during your session period, it stays in the memory. The same applys to the booking seats.
Joseph Zhou
Ranch Hand

Joined: Aug 01, 2000
Posts: 129
Hi Annie,
Thank a lot for your reply, but it seems my question is not clear enough. Say when I going to book a fight, I search the available seats, and pick up one to my "shopping cart", I don't persist it to DB at this time(otherwise I need a mechanism to clear up some unpaid booked seats). Meanwhile, somebody see that seat too, booked and checked out it before me, so I have a trouble when I want to check it out. This is common issue of online shopping cart, no harm in many senarios, but do need to be handled for booking seat. Any suggestion?
Hu Rui
Greenhorn

Joined: Nov 19, 2004
Posts: 18
You have to understand HTTP session.

The shopping cart is just one object under the HTTP session.

After user login, the HTTP session object is create. Then you can attack the shopping cart object to the session object. How you get the shopping cart? There are many way. You can save the cart in DB, so it will be valid, for a long time, accross many login session.

Others can see you shopping cart. If you want to do so. Why not. But no one can see your session.


SCEA<br />SCJP SCJD SCWCD SCBCD
Joseph Zhou
Ranch Hand

Joined: Aug 01, 2000
Posts: 129
Hi Hu Rui,
What you said is right, but is still my problem. You go to supermarket, put something in your shopping cart, nobody can take it from you if you want to check it out. but this is not the case for most online session "shopping cart". You can persist it to DB(then the session "shopping cart" may not required), but you have to clear up some uncheck-outed with some condition, say 1 hour, and within the 1 hour, nobody can touch it and the system may lose business opportunities to sale it to other person. and for online senario, many people may just want a try or any other reason to put something in their shopping cart without check-out and left their browser open and leave for long long time...I know most people using the first solution, but the potential risk is there, there are also some cons for sulotion 2.
Annie Zhang
Ranch Hand

Joined: Sep 08, 2004
Posts: 31
I asked the same question, check this, hope it helps.

http://www.coderanch.com/t/152786/java-Architect-SCEA/certification/Part-II-reserved-seat-taken
Hu Rui
Greenhorn

Joined: Nov 19, 2004
Posts: 18
Application server give you session object.
But it is up to you to add shopping cart to session object.

You can save your shopping cart in DB with a time stamp, say valid for 2 days. Next time when user login, first thing you do is read out shopping cart from DB and attach it to session objects.

Session and shopping cart are two things.
Shopping cart is just one object attached to the session.
Joseph Zhou
Ranch Hand

Joined: Aug 01, 2000
Posts: 129
Great, thank you Annie.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: shopping cart or shopping memo?