I am trying to get my checkbox marked by setting an attribute of a model to true, but it does not get checked. This is my checkbox:
<div class="row text-center">
<input type="hidden" value="on" name="_abroad"/>
<input type="checkbox" name="abroad" onchange="getAbroad(this)"
th:checked="${abroad} ? 'checked'"/>
<span>Abroad</span>
</div>
and this is my model where I set my abroad property to true and the corresponing object I am adding to my model:
controller:
cityWrapper.setAbroad(true);
model.addAttribute("city", cityWrapper);
my wrapper:
public class CityWrapper {
private List<City> cityList;
private boolean abroad;
}