I'm trying to append a css class depending on multiple if cases with the ternary operator.
Is my ternary wrong?
I get the below error:
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression error.
If I look up the doc or other posts here I couldn't find a correct solution.
My code is the following:
<table>
<tr th:each="product: ${products}">
<th th:text="${product.status}"
th:classappend="
${product.status == 0} ? class1 :
${product.status == 1} ? class2 :
${product.status == 2} ? class3 :
${product.status == 3} ? class4 : class5">
</th>
<table>