Thymeleaf:添加到现有值而不是替换它们

Thymeleaf: Add to existing values instead of replacing them

有没有办法告诉 Thymeleaf 向标签添加参数而不是覆盖它们?

示例:

 <div class="a" th:class=${x ? 'b' : 'c'}>

结果应该是

<div class="a b">

<div class="a c">

此致

另一种方法是

th:attr="class=|a ${x ? 'b' : 'c'}|"