thymeleaf中不用自己去写checked="checked" selected="selected"这种代码,他自己会选。
input
<input type="text" class="form-control1" id="name" name="name" th:value="${user.name}">
select
<label class="col-sm-2 control-label">类别label> <div class="col-sm-8"><select name="cId" id="cId" class="form-control1" ><option value="1" th:field="*{book.cId}">目录1option><option value="2" th:field="*{book.cId}">目录2option><option value="3" th:field="*{book.cId}">目录3option><option value="4" th:field="*{book.cId}">目录4option>select> div>
radio(*{回显数据})
<label for="isBoy" class="col-sm-2 control-label">是否男生label><div id="isBoy" class="col-sm-8"><div class="radio-inline"><label><input name="isBoy" type="radio" value="1" th:field="*{book.isBoy}"/> 否label>div><div class="radio-inline"><label><input name="isBoy" type="radio" value="0" th:field="*{book.isBoy}"/> 是label>div>div>
参考:https://blog.csdn.net/tuntun1120/article/details/79806669