Thymeleaf - Elvis operator not working as intended

Viewed 546

My code is the following:

<div class="container-fluid" th:object="${content}">
    <span th:text="*{poster}?: 'no poster'"></span>
</div>

If poster is null, then the span should display "no poster". Instead it displays "N/A":

<span>N/A</span>

When the poster is present, it behaves as expected.

I looked at the documentation and couldn't understand where my mistake is.

1 Answers

The Elvis operator only works for null values. N/A values aren't actually null.

Related