第二次迭代清单
我有一个带有胸腺的页面,并通过各节列表迭代,以为每个部分创建按钮。稍后,在同一页面中,我想再次迭代同一列表,但我遇到了一个空错误
<div class="sections">
<div th:each = "section: ${chapter.getSections()}" th:text= "${section.getTitle()}"/>
</div>
.
. // Later on the code
.
// This is where I get the null exception trying to call section.getContent()
<div th:each = "section: ${chapter.getSections()}" th:insert="${section.getContent()}"/>
I have a page produced with thymeleaf and I iterate through a sections list to create buttons for each section. Later in the same page I want to iterate the same list again but I get a null error
<div class="sections">
<div th:each = "section: ${chapter.getSections()}" th:text= "${section.getTitle()}"/>
</div>
.
. // Later on the code
.
// This is where I get the null exception trying to call section.getContent()
<div th:each = "section: ${chapter.getSections()}" th:insert="${section.getContent()}"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论