Spring Boot 2.0.3 thymeleaf错误呈现某些页面

时间:2019-01-30 14:50:39

标签: java spring spring-boot thymeleaf

我最近将spring boot升级到了2.0.3版本,并且某些模板开始失败,我遇到了这个错误:

An error happened during template parsing (template: "class path resource [templates/mypage.html]") 
Caused by: org.attoparser.ParseException: null
Caused by: java.util.ConcurrentModificationException: null

有人遇到这个问题吗?

2 个答案:

答案 0 :(得分:1)

问题在于html呈现选择组件列表的方式,它在th:每个这样的内部都有一个选择:

<div th:each="lsPassengers, ***stat*** : *{lsPassengers}">
    <select class="e1 populate w-240 tPassengers" name="tPassengers">

    <option th:each="i, ***statPax***: ${session.travelPartner}" 
                            ...
                        </select>
</div>

在以前的版本中,变量stat被用在select的循环中(不知道为什么),但之前却起作用,我更改了另一个变量(statPax)的重用变量,然后又开始工作

希望这对其他人有帮助!

答案 1 :(得分:0)

每当您在迭代集合时尝试修改集合时,都会在运行时引发

ConcurrentModificationException。您在失败的观点中有这种情况吗?如果是这样,请尝试使用此link