Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法使用字符串和 int 值连接的键来访问 EL 中的 HashMap 元素。像这样的东西:
<c:forEach begin="1" end="5" var="current"> <c:out value="${myHashMap['elem-' + current]}"/> </c:forEach>
此代码可以完成所需的行为
<c:forEach begin="1" end="5" var="current"> <c:set var="key" value="elem-${current}" /> <c:out value="${myHashMap[key]}"/> </c:forEach>