Using JSTL how to “put” a value into a HashMap

前端 未结 2 1458
难免孤独
难免孤独 2021-01-05 00:49

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 s

相关标签:
2条回答
  • 2021-01-05 01:27

    I wouldn't use JSTL to do that, but straight-up JSP will get it done...

    <%
    myHashMap.put("hello", "world");
    %>
    
    0 讨论(0)
  • 2021-01-05 01:44

    You can use the <c:set>.

    <c:set target="${myHashMap}" property="key" value="value"/> 
    
    0 讨论(0)
提交回复
热议问题