<option th:each="car,userStat:${carList}" th:value="${car.carId}" th:text="${car.name}"></option>
-
<div class="form-group"> -
<label for="parentId" class="col-sm-2 control-label">车</label> -
<div class="col-sm-8"> -
<select name="carIs" id="carId" class="form-control1"> -
<option th:each="car,userStat:${carList}" th:value="${car.carId}" th:text="${car.name}"></option> -
</select> -
</div> -
</div>
选中的情况下
返回的map中有2个值
一个是carList 一个是car
-
<option th:each="list,userStat:${carList}" th:value="${list.carId}" th:text="${car.name}" -
th:selected="${list.carId == car.carId}"></option>
参考地址 https://blog.csdn.net/tuntun1120/article/details/79849273
来源:51CTO
作者:那些年的代码
链接:https://blog.csdn.net/weixin_44018338/article/details/100033615