Reputation: 13
I wrote this condition and does not work:
<fieldset class="rating">
<span class="course-view-rating bigger">
<label th:class="${feedback.message.rating ≥ 5}? 'active'" for="rating5"></label>
<label th:class="${feedback.message.rating ≥ 4}? 'active'" for="rating4"></label>
<label th:class="${feedback.message.rating ≥ 3}? 'active'" for="rating3"></label>
<label th:class="${feedback.message.rating ≥ 2}? 'active'" for="rating2"></label>
<label th:class="${feedback.message.rating ≥ 1}? 'active'" for="rating1" ></label>
</span>
</fieldset>
The value of feedback.message.rating
is always a number from 0 to 5.
Using:
This is the error message:
Servlet.service() for servlet [thymeleafDispatcherServlet] in context with path [/frontend-th] threw exception
[Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException:
Exception evaluating SpringEL expression: "feedback.message.rating ? 1" (template: "pages/eventdetail" - line 179, col 52)] with root cause
java.lang.IllegalStateException: Cannot handle (8805) '?'
Thanks for the response
Upvotes: 0
Views: 3853
Reputation: 567
You should try this one,
<label th:class="${feedback.message.rating} >= 5 ? 'active'" for="rating5"></label>
Upvotes: 3
Reputation: 13
This is working and i don't understand why :D :D
<label th:class="${feedback.message.rating >= 5}? 'active'" for="rating5"></label>
Upvotes: 0