thymeleaf / select option list遍历循环
<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