第一种情况:数据只是一个状态码的回显,返回的只是单纯的数值。
<div class="layui-inline">
<label class="layui-form-label febs-form-item-require">性别:</label>
<div class="layui-input-inline" style="width: 190px;">
<select name="sex" lay-verify="">
<option value="1" th:field="*{participant.sex}">男</option>
<option value="2" th:field="*{participant.sex}">女</option>
</select>
</div>
</div>
第二种情况:回显数据是一个集合需要遍历,其中 th:selected="${competition.id} eq ${participant.competitionId}"的participant是你后台查询到的对象传到前端的。
<div class="layui-form-item">
<label class="layui-form-label febs-form-item-require">赛事名称:</label>
<div class="layui-input-inline">
<select disabled="disabled" name="competitionId" id="competitionId" lay-filter="selectCompetition"
lay-verify="">
<option>请选择赛事</option>
<option th:each="competition : ${competitionList}" th:value="${competition.id}"
th:text="${competition.name}"
th:selected="${competition.id} eq ${participant.competitionId}"></option>
</select>
</div>
<label class="layui-form-label febs-form-item-require">参赛主题:</label>
<div class="layui-input-inline" style="width: 300px;">
<select disabled="disabled" id="selectTheme" name="competitionThemeId" lay-verify="">
<option>请选择参赛的主题</option>
<option th:each="theme : ${themeList}" th:value="${theme.id}"
th:text="${theme.theme}"
th:selected="${theme.id} eq ${participant.competitionThemeId}"></option>
</select>
</div>
</div>
在此记录一下一个后台爪哇boy再写前端过程中的感受,事情给你了你做也得做,不做好像也不行,感觉没有单纯的后台,哈哈哈,可能是自己还是菜!