[英]accessing values in a map using c:out tag
trying to access a value from a map in ac:out tag but the following doesn't appear to be displaying any value. 尝试从ac:out标记中的映射访问值,但以下内容似乎未显示任何值。 Here's the code:
这是代码:
<c:out value=" letterForm.criteria.map['letterForm.criteria.type']" />
anyone have any ideas how to get the value from a map other than using the following code as it seems a bit inefficient as we have a map and know the key value. 除了使用以下代码外,任何人都对如何从映射中获取值有任何想法,因为我们拥有映射并知道键值似乎效率不高。
<c:forEach var="exCovValue" items="${letterForm.criteria.map}">
<c:if test="${exCovValue.key == letterForm.criteria.type}">
<c:set var="extraCoverValue" value="${exCovValue.value}" />
</c:if>
</c:forEach>
Thanks 谢谢
You left out the ${}
. 您忽略了
${}
。 Try this: 尝试这个:
<c:out value="${letterForm.criteria.map['letterForm.criteria.type']}" />
This worked: 这工作:
<c:out value="${letterForm.criteria.map[letterForm.criteria.type]}" />
was trying it like this: 尝试这样:
<c:out value="${letterForm.criteria.map['letterForm.criteria.type']}" />
but removing the quotes (') worked. 但是删除引号(')是可行的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.