The .put() method of Map takes a key and value as parameters. Your code reads:
which means you're putting "this", i.e. the instance of your CartBean into the Map as the key.
I'm not sure I can suggest exactly what you should be doing as your CartBean class seems to be trying to be both a Cart and a CartItem.
You might want to seperate out the Cart (backed by a Map) from items that go into a Cart (seperate class with the getters and setters that you're currently defining in CartBean). The Cart class would have an addtoCart(CartItem item) method which does something like:
Or maybe I'm just misunderstanding what you're trying to do. Hope this helps.
[ October 25, 2003: Message edited by: Matt Read ]