【thymeleaf】Exception evaluating SpringEL expression: "xxxx"

这个错误本质就是表达式转换时报错了

1、要么集合里没数据

2、属性拼写错误

 

本地复查步骤如下:

1、首先可以确保集合数据是存在的,因为后台在返回给前端页面时,我有打印每个元素。

2、取属性的单词也不是手打的,直接从打印的语句里面拷贝的

3、同样的循环, 换为绑定另外一组数据后显示正常。

<option th:each="dept:${depts}" th:text="${dept.getDepartmentName()}" th:value="${dept.getId()}"></option>
<!--<option th:each="emp:${emps}" th:text="${emp.getId()}" th:value="${emp.getId()}"></option>-->

4、最后解决方案:

在后台给model绑定值时,将原来的集合名字departments改为了 dpts,前端绑定成功。。。。。

posted @ 2022-07-02 09:28  狼窝窝  阅读(642)  评论(0)    收藏  举报