• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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 ]
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic