Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create shopping cart and store multiple items in it using servlets and session tracking

 
Jeff Numo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have only just started learning about servlets, java and JDBC stuff and would like some help on creating a shopping cart that does the following:

1. Can add multiple items to the shopping cart, so it doesn't wipe the shopping cart once you leave that page or add another item to it.
2. Display the total price of all the items that has been added to the shopping cart.
3. Have an option for the user to remove an item from the cart.

The thing I don't understand is how to store multiple items using some sort of session tracking since I have never learnt it before.

Any help would be appreciated and thank you in advance.

Here is my code:



And my attempt at making a shopping cart:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65339
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not be creating your HTML view inside strings inside Java code. That's what a JSP is for. Please read this article for information on how to properly structure Java web applications.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic