thymeleaf-spring
thymeleaf-spring copied to clipboard
Thymeleaf throwing error Exception evaluating SpringEL expression, for lists in HashMap
I have this code
HashMap<String, List<String>> 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]