Thymeleaf 嵌套取map中的值 (用获取的值,作为key,获取map中的value)
Thymeleaf 嵌套取map中的值 (用获取的值,作为key,获取map中的value)
<td th:text="${projectStatus.get(thisStatus)}"></td>
其中
projectStatus={1:"a",2:"b"} 是一个map
thisStatus=1
这样以上这样无法取到值"a",显示为空
<td th:text="${projectStatus[thisStatus]}"></td>
这样也是一样
<td th:text="${projectStatus[${thisStatus}]}"></td>
嵌套使用${}会报错
<td th:text="${projectStatus[1]}"></td>
直接输入1正常输出
有没有办法实现嵌套取值呢?