Thymeleaf: th:selected in a drop-down list

Viewed 1425

I want to select an option of a Select Box based on the Locale Country but there s no way. I've tried:

<option value="AR" th:selected="${#locale.country.contains('AR')}" >Argentina</option>
<option value="AR" th:selected="${#locale.contains('AR')}" >Argentina</option>
<option value="AR" th:selected="${__${#locale}__.contains('AR')}" >Argentina</option>
<option value="AR" th:selected="${#{__${#locale}__}.contains('AR')}" >Argentina</option>

This option shows the country (US)

<option value="US" th:text="${#locale.country}" th:selected="${#locale.country == 'US'}"  >United States</option>

But this option is not selected.

1 Answers
Related