Thymeleaf throwing error Exception evaluating SpringEL expression, for lists in HashMap
sathishvenkataraman opened this issue · 0 comments
sathishvenkataraman commented
I have this code
HashMap<String, List> shopCat;
data goes like this: shopCat => {"Vegetables":["Carrot",...], "Fruits":["Apple",....]}
model.addAttribute("shopCat", shopCat);
View code:
<tr th:each="sCat : ${shopCat}">
<tr th:each="sList: ${sCat.value}">
<tr th:each="item: ${sList}">
<td th:text="${item}"></td>
...
I get this error: Exception evaluating SpringEL expression: "sCat.value"
interestingly if I try to print key and value of sCat, it prints, but cannot iterate..
<tr th:each="sCat : ${shopCat}">
<td th:text="${sCat.key}"></td>
<td th:text="${sCat.value}"></td>
...
output: Veg=[Carrot, Potato] Fruits=[Apple, Melon]