Twitter bootstrap Thymefelaf th:给定html标记的class属性中的文本

Twitter bootstrap Thymefelaf th:给定html标记的class属性中的文本,twitter-bootstrap,spring-boot,thymeleaf,Twitter Bootstrap,Spring Boot,Thymeleaf,我有一个Spring boot、Thymeleaf和Bootstrap应用程序。我在GUI中有很多组件,其中一些共享相同的引导颜色值。我经常改变颜色,这是真的很麻烦,通过代码,并找到和更新所有组件使用相同的颜色 我想这样做: 在我的messages.properties文件中,我将有如下内容: login_modal_header_color=purple darken-4 <div class="modal-header text-center th:text='#{login_mod

我有一个Spring boot、Thymeleaf和Bootstrap应用程序。我在GUI中有很多组件,其中一些共享相同的引导颜色值。我经常改变颜色,这是真的很麻烦,通过代码,并找到和更新所有组件使用相同的颜色

我想这样做:

在我的messages.properties文件中,我将有如下内容:

login_modal_header_color=purple darken-4
<div class="modal-header text-center th:text='#{login_modal_header_color}'">
并且能够在类属性中获得该值,如下所示:

login_modal_header_color=purple darken-4
<div class="modal-header text-center th:text='#{login_modal_header_color}'">
问题是,当您在中使用th:text={login\u modal\u header\u color}时,它只是一个文本,而thymeleaf不会拾取它。

应该使用th:classappend: