Closed brett53559 closed 1 year ago
This is not an error with Thymeleaf but instead a oversight on my part.
The code should have read
<th:block th:fragment="registrationDetails()">
<ul>
<li th:text="${'Name: ' + registration.getUsers().getName()}"></li>
<li th:text="${'Date: ' + registration.getScheduleDateAsString()}"></li>
<li th:text="${'Room: ' + registration.getRooms().getName()}"></li>
<li th:text="${'Time: ' + registration.getTimeSlots().getStandardTime()}"></li>
<li th:text="${'Meal: ' + (registration.getMealOptions() != null ? registration.getMealOptions().getSignUpName() : 'Own')}"></li>
</ul>
</th:block>
Parenthesis surrounding the conditional operation.
I'm having an issue where using a th:text method and then using concatenation with a conditional operator is causing the incorrect operation to execute.
Here is the gradle configuration
Here is the ThymeleafTemplateConfiguration class
Here is my TemplateRenderService class
Here is the code block where i assign values to the context for fragment rendering
Here is the code block of the headGroupUserRemoved fragment
In this block the "registration.getMealOptions()" IS null. However, it produces the following error info I also tried the reverse "'Meal: ' + registration.getMealOptions() == null ? 'Own' : registration.getMealOptions().getSignUpName()" and it was the same error result.
When I change it to this code
There is no issues.