用thymeleaf用标签给页面select下拉框赋值
<div class="form-group">
<label>性别</label> <select class="form-control" id="sex">
<option value="1" th:selected="${sex=='1'}">男</option>
<option value="2" th:selected="${sex=='2'}">女</option>
</select>
</div>
本文介绍如何使用Thymeleaf为HTML页面的select下拉框元素动态赋值,通过th:selected属性实现选项的默认选中状态。
7573

被折叠的 条评论
为什么被折叠?



