Thymeleaf 回显checkbox、select
<div class="form-group"> <label class="col-sm-3 control-label">添加标签:</label> <div class="layui-input-block"> <tr th:each="d : ${bts}"> <input type="checkbox" th:value="${d.id}" name="tagbId" th:title="${d.name}" th:attr="checked=${d.checked }" /> #<label th:text="${d.name}"></label> </tr> </div> </div>
<div class="form-group"> <label class="col-sm-3 control-label">添加话题:</label> <div class="col-sm-8 radio" > <select name="topicId" th:value="${topid}"id="topic" class="form-control"> <option th:selected="${topid==dict.id}" th:each="dict : ${topics}" th:value="${dict.id}" th:text="${dict.content }"> </select> </div> </div>