• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

shopping cart or shopping memo?

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Joseph Zhou
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I asked the same question, check this, hope it helps.

https://coderanch.com/t/152786/java-Architect-SCEA/certification/Part-II-reserved-seat-taken
 
Hu Rui
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great, thank you Annie.
 
reply
    Bookmark Topic Watch Topic
  • New Topic