Assume that a query result exists called resultSet having a field available as templateId.
Also, a map 'templateMap' exists with keys of templatedId.
I am not able to get any result from the following, any help appreciated.
<c:foreach var="row" items="${resultSet.rows}">
  <c:out value="${templateMap[row.templateId]}" />
</c:foreach>
Note: this is a coding horror application, wherein the above resultset is a result of <sql:query>. 
Following doesn't work either.
<c:foreach var="row" items="${resultSet.rows}">
  <c:set var="tmplId" value="${row.templateId}" />
  <c:out value="${templateMap[tmplId]}" />
</c:foreach>