最近我开始学习使用ftl freemarker。我使用 #assign 创建了一个hashMap。
更新这个hashMap的值有什么推荐的方法吗?
在freemarker中,数据结构(如map、list等)是否是不可变的?
<#assign hashMap1= { "name": "mouse", "price": 50 } >
hashMap1.name = "cat"; // gives error
<#assign hashMap1= hashMap1 + {"name": "cat"} /> // this works fine , but I don't like this approach. it gives false sense of adding keys where we are updating keys.
我尝试在这里freemarker内置函数中找到相关信息,但没有。