I have a List of HashMaps (both the key and value are strings)
List list=new ArrayList();
for(int i=0;i<10;i++)
{
Map map=new HashMap();
for(int j=0;j<10;j++)
{
map.put("key"+j,"value"+j);
}
list.add(map);
}
This list is in an action form. what is syntax to get/set values in the map?
What is the naming convention I should follow so that struts can populate the map values when we submit the form?
thank you
-
struts mapped properties (1 messages)
- Posted by: chip dale
- Posted on: February 10 2006 18:46 EST
Threaded Messages (1)
- you have to name Map properly by Majid Kalkatechi on February 24 2006 13:56 EST
-
you have to name Map properly[ Go to top ]
- Posted by: Majid Kalkatechi
- Posted on: February 24 2006 13:56 EST
- in response to chip dale
you use your Struts tag in jsp like below:
<html:hidden property="<%="value(mapKey)"%>"/>
then struts invoke getValue(String key,String value) in your form. attention that struts make first letter of "property" attribute capital. In the invokation process, strut send your "mapKey" value for key parameter of the method and the value of your tag as the "value" parameter of the method.