【发布时间】:2020-04-11 13:25:22
【问题描述】:
这是我第一次使用 thymeleaf,如果用户输入错误的凭据,我会使用 Spring 将 flash 属性返回到登录页面。
将显示错误消息(2 个div's),但不会呈现内部的<span class="closeBtn">。
源代码
<div th:if="${message}" class="row">
<div th:text="${message}" th:class="${'col s8 offset-s2 m6 offset-m3 alert ' + alertClass}">
<span class="closebtn">×</span>
</div>
</div>
消息的右侧应该有一个“x”。我打开了浏览器检查器,它也没有显示在 HTML 中。
浏览器检查器代码
<div class="row">
<div class="col s8 offset-s2 m6 offset-m3 alert error">Incorrect username / password.</div>
::after
</div>
【问题讨论】: