How to get key and value from Map in ATG ?

atg
Prabhat Kumar Singh picture Prabhat Kumar Singh · Aug 24, 2012 · Viewed 7.2k times · Source

How to get key and value from Map in ATG ?

<dsp:getvalueof var="omap" param="map"/>

<dsp:valueof value="${omap.key}"/>

I am not able to see any values, I have multiple key and value in map

<dsp:valueof value="${omap}"/> 

working fine.

Answer

Ramkumar picture Ramkumar · Jul 12, 2013

Use ServiceMap datatype in your class and in your JSP use code snippet

<dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="empployeemap"/>
<dsp:setvalue param="employee" paramvalue="element" />

<dsp:oparam name="output">
    <tr>
        <td width="10%"><dsp:valueof param="employee.empid" /></td>
        <td width="20%"><dsp:valueof param="employee.dob" /></td>
        <td width="70%"> </td>
    </tr>
</dsp:oparam>
</dsp:droplet>