Adds an entry to a Map. The entry will have the key and value as defined by the resolved values of this command's attributes.
setMap
, the map
attribute may be left undefined to have the parent command's new Map receive the entry.
key | ||
---|---|---|
Required |
Value type |
EL-evaluated |
Yes | String | Yes |
Defines the key for the generated map entry. If the Map already has an entry with this key, that entry will be replaced by this new entry. |
value | ||
---|---|---|
Required |
Value type |
EL-evaluated |
Yes | Any | Yes |
Defines the value for the generated map entry. |
map | ||
---|---|---|
Required |
Value type |
EL-evaluated |
No | Map | Yes |
Defines the Map into which the new entry is added. A Data item is also a valid value, as it is a specialized Map. If this attribute is undefined and this command is a child of setMap , the entry is added into that newly created Map. Leaving this attribute undefined if this command is not a child of setMap is considered an error. |
Use addMapEntry
together with setMap
to create new Maps with content.
<setMap var="dynamoPerson">
<addMapEntry key="firstName" value="Millie">
<addMapEntry key="lastName" value="Dynamoweaver">
On its own addMapEntry
can be used to add a new entry or overwrite an existing entry of any Map.
<setMap var="activeItem">
<addMapEntry key="wasModified" value="${false}">
...
<addMapEntry key="wasModified" value="${true}" map="${activeItem}">