Two Laptop Bag*
The moose likes Servlets and the fly likes how to create shopping cart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to create shopping cart" Watch "how to create shopping cart" New topic
Author

how to create shopping cart

Sachin Kadian
Ranch Hand

Joined: Jan 24, 2012
Posts: 33
I am designing a website for online shopping. i need the option of " add to shopping cart" . A user can add any item to his shopping cart. how can i do so?? if i do this by creating table in database the how can i create dynamic tables in database?? please suggest me any other option too.. thanhx.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What does adding an item to a shopping cart have to do with creating table? The table should have been created before the web app containing the shopping cart was ever first run, no? Or are you proposing to create a new table for each user? That would be such an unusual design that I would strongly urge you to reconsider.
Ernesto Arroyo
Greenhorn

Joined: Mar 06, 2011
Posts: 11

Well, A shopping cart is implemented using Sessions, but I agree with Tim that you have to rethink a little because there are some weird concepts mixed...
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I used cookies (as the session was so short) but I am sure I will be shot down for this

Edit: no it wasn't a good example.
Ernesto Arroyo
Greenhorn

Joined: Mar 06, 2011
Posts: 11

cookie for the shopping cart?

The items should be saved in the server, not in a cookie. Sounds rather weird!
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

Ernesto Arroyo wrote:cookie for the shopping cart?

The items should be saved in the server, not in a cookie. Sounds rather weird!


I needed to keep the cart for users who hadn't logged in yet, so couldn't think how to id them.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Advanced shopping carts will generally use a number of solutions, including cookies, the session, and a database to account for the numerous situations (logged in vs. not logged in, and so on).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 152

Check out netbeans java e-commerce tutorial. There is a great implementation of one there: netbeans tutorial
pravin venkat
Greenhorn

Joined: Mar 30, 2012
Posts: 20
Interesting HTML5 Implementation:

http://www.webdesignermag.co.uk/blog/create-a-shopping-cart-with-html5/
 
jQuery in Action, 2nd edition
 
subject: how to create shopping cart