【发布时间】:2017-09-21 11:29:50
【问题描述】:
我正在将我的应用程序从 JSP 移植到 Thymeleaf,我在尝试使用 classappend 时发现了一些问题
如果操作完成,我有一个 div 元素,无论是好是坏,我通常都会在我的控制器中添加一个 $css 值以附加到 div 类。
我不能在 Thymeleaf 中做到这一点......我正在尝试这种方式
<div th:classappend="${css != null} ? alert alert-${css} alert-dismissible"
th:text="${msg != null} ? ${msg}">
<button title="close" type="button" class="close"
data-dismiss="alert" aria-label="Close" aria-hidden="true">
x</button>
<strong th:text="${msg}"></strong>
</div>
${css} 可能是危险或成功或任何其他 Bootstrap 文本类...
我来了
Could not parse as expression: \"${css != null} ? alert alert-${css} alert-dismissible\
这有什么问题?
【问题讨论】:
标签: css spring-boot thymeleaf