Using JSTL as a “put” value in a HashMap

I am looking to set a pair of HashMap key values ​​using JSTL only. Is it possible?

I know how to get key value pairs, but I have not found a way to set them.

Any help would 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}" /> ... 
+6
source share
2 answers

You can use <c:set> .

 <c:set target="${myHashMap}" property="key" value="value"/> 
+18
source

I would not use JSTL for this, but directly JSP will execute it ...

 <% myHashMap.put("hello", "world"); %> 
0
source

Source: https://habr.com/ru/post/905248/


All Articles