• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Hashmap's value in jsp?

 
lyo Yashnoo
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:
I am writing a shopping cart using jsp.Now I create a HashMap in javabean.When user select a things I add the things'name and its number into HashMap.
The problem is how to get all the value of the HashMap and put all the value to a javabean(it has getter and setter method)?
I also find that if the value in the HashMap is the same,the previous value will be delete.
I want to know whether my method is right.If someone has a better good idea please tell me.Thnks :roll:
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iyo,
No need to check for pervious values,as HashMap will do it for u,I mean to say if u add two values to HashMap with same keys then the latest value will be reflected.
Regards
Praful
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This really has nothing to do with JSPs, but rather collections and maps, so I'm moving it to Java in General (intermediate).
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic