Thymeleaf select 反显 默认选中
作者:
Morgan7 | 来源:发表于
2019-12-16 14:00 被阅读0次
后台代码
List<ExamTestPaperDO> list = examTestPaperService.list(map);
model.addAttribute("testPaper",list);
model.addAttribute("testPaperId",request.getParameter("testPaperId"));
页面代码
- 关键代码
th:selected="${test.id eq testPaperId}"
<select id = "testPaperId" name="testPaperId" class="form-control">
<option value="">所有</option>
<option th:each="test : ${testPaper}" th:value="${test.id}" th:text="${test.name}" th:selected="${test.id eq testPaperId}"></option>
</select>
本文标题:Thymeleaf select 反显 默认选中
本文链接:https://www.haomeiwen.com/subject/xhxdnctx.html
网友评论