• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Shoppingcart session problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

I`m quite new to jsp but have to build a simple shoppingcart for practice.

I use this code like below:





Now every time i add my first item to the cart it works. But when i add my second item it removes the first item and just adds the second one.

How can i make sure both items will stay in the cart together?

Thanks in advance!
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You clear one item when you insert the other. Remember the input fields are in different forms. You really should just use a free E-Commerce program instead of creating your own.

String dvd1 = request.getParameter( "simpsons" );session.setAttribute( "theSimpsons", dvd1); String dvd2 = request.getParameter( "futurama" );session.setAttribute( "futurama", dvd2);
[ October 30, 2004: Message edited by: Bear Bibeault ]
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic