Java – how to “put” values into a HashMap using JSTL

I'm looking for key value pairing for HashMap using JSTL only Is that possible?

I know how to retrieve key value pairs, but I haven't found a way to set them

Any help will be greatly 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}" />
...

Solution

You can use < C: set >

<c:set target="${myHashMap}" property="key" value="value"/>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>