I need to set custom attribute (data-validation-matches-message) value from messages resources.
Since Thymeleaf 2.1 you can do this:
<a data-th-attr="data-groupid=${somevalue}, data-groupname=${someothervalue}">...</a>
source
Using 3.0.9.RELEASE
:
<td th:text="${item.description}" th:attr="width=${isSplit} ? '44%' : '59%'" />
This will add width="44%"
or width="59%
according to a boolean set in the variables.
width
might as well have been any other custom attribute.
Try this:
<input th:attr="data-validation-matches-message='\'' + #{user.notfound}" + '\''"/>