struts mapped properties

Discussions

Web tier: servlets, JSP, Web frameworks: struts mapped properties

  1. struts mapped properties (1 messages)

    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
  2. you have to name Map properly[ Go to top ]

    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.