Ok this is basic, but I'm stumped here at the moment...

Imagine a Map of Animals. (Animal has a "name" property)

map.put(new Integer(1), new Animal() );
map.put(new Integer(2), new Animal() );

In my Action form this map is in there as:

private Map animalsMap;
getAnimalsMap()
setAnimalsMap(Map map);

Question:

In this example I know the key names (1 and 2). I want to be able to update the "name" for each animal that is in the map from a form:

<html:text property="animalsMap[1].name"/>
<html:text property="animalsMap['1'].name"/>

<html:text property="animalsMap[2].name"/>

neither of the above works, but I'm not sure why. Do I need to have a getAnimalsMap(Object key) method? If so that's annoying, since if my map was nested in a value ojbect I could get this to work fine.

What stupid easy thing am I doing wrong here?

(By the way I know the maps are populated correctly because I can do this in JSTL and see the field fine.. in this case 'metadata' equals concept of 'name' above)

<c:forEach items="${tierMaintenanceForm.metadataObjectsMap}" var="meta" varStatus="metaStatus">
            ${meta.key} -- ${meta.value.metadata} <br/><br/>
         </c:forEach>


--
tia,

Rick





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to