I have a select box on my thymelaf page. I already have defined one attribute for it like:
th:attr="labelId='associateTSF' + ${mViewStat.index}"
Is there a way to set more than one? something like:
th:attr="labelId='associateTSF' + ${mViewStat.index}; missionGroup=${mView.missionGroup}"
I have already tried this with ; and with blank space, no success. All examples I have found are with single value.
Thanks!
html file should be placed under the templates directory and all JS and CSS files should be placed under the static directory in classpath. In the example shown, we used CSS file to change the color of the text. Now, we need to add the Spring Boot Starter Thymeleaf dependency in our build configuration file.
This is the default behaviour of the th:text attribute. If we want Thymeleaf to respect our XHTML tags and not escape them, we will have to use a different attribute: th:utext (for “unescaped text”): <p th:utext="#{home.welcome}">Welcome to our grocery store!</
th:block is a Thymeleaf element rather than an attribute, and it has the general syntax: 1 2 3. <th:block> <!-- Your HTML code --> </th:block> th:block allows you to apply the same Thymeleaf attribute, like th:if or th:each to a block of code.
Found it! And it works. It should be separated by comma.
HTML forbids repeated attributes, so that code is not correct. However, th:attr and data-th-attr allow you to specify several attributes separated by commas, like:
<a href="#" data-th-attr="data-groupid=${somevalue}, data-groupname=${someothervalue}">...</a>
found it on this discussion: https://github.com/thymeleaf/thymeleaf/issues/93
This worked for me
th:attr="attrParam1=${attrVal1}, width=${width != null ? width : null}, height=${height != null ? height : null}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With