• 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

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic