This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to get Hashmap's value in jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to get Hashmap Watch "How to get Hashmap New topic

How to get Hashmap's value in jsp?

lyo Yashnoo
Ranch Hand

Joined: Sep 15, 2003
Posts: 50
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

Joined: Feb 10, 2001
Posts: 613
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.

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60082

This really has nothing to do with JSPs, but rather collections and maps, so I'm moving it to Java in General (intermediate).

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How to get Hashmap's value in jsp?
Similar Threads
Loading a file in a servlet at run time
naming objects at runtime
getting array values from HashMap!!!
Method Hash
HashMap Doubt