• 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

bean:define and hash map

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

i have one hashmap field in my form bean.It inturn contains few hasmap in it,which is set in the action class.
My requirement is i have to retreive a hashmap basing on the key ,from the field in my form bean and have to use that one to populate drop down ...
any idea??
I mean

in my form bean
HashMap testMap()=null; //it has getter and setter in the bean


i am setting some other hashMap to it in my action class..
like
//action class

HashMap sampleMap=new HashMap();
HashMap sampleMap1 =new HashMap();

sampleMap.put("sampleMap1",sampleMap);
myForm.setTestMap(sampleMap);


>on my jsp i want to retrieve the key and value pairs in sampleMap1 and have to make use it to populate my drop downs...
any help?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can access the map this way:

The action class code:


The jsp code:


The result:


I hope this is the only place in the application where you are accessing the above data structure, if not then it would better to design a custom tag for the same.
[ July 27, 2006: Message edited by: Dileep Kamath ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic