I'm looking to set the key value pairing of a HashMap using JSTL only. Is this possible?
I know how to retrieve the key value pairs, but I haven't found a way to set them.
Any help would be appreciated.
Example of retrieving HashMap key/value pairs using JSTL:
<c:forEach var="hash" items="${myHashMap}">
<c:out value="${hash.key}" />
<c:out value="${hash.value}" />
...
您可以使用<c:set>
。
<c:set target="${myHashMap}" property="key" value="value"/>
I wouldn't use JSTL to do that, but straight-up JSP will get it done...
<%
myHashMap.put("hello", "world");
%>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.