thymeleaf(th:each th:selected) 从后台动态获取下拉框数据回显及选中
<select οnchange="getChilds(this.value)" id="catId" name="catId"><option value=""> -- 请选择 -- </option><option th:selected="${goods.catId eq c.id}" th:each="c:${categoryList}" th:value="${c.id}" th:text="${c.name}" value="1">蔬菜</option>
</select>
th:selected="${goods.catId eq c.id}":代码部分为下拉框选中
th:each=“c:${categoryList}” th:value="${c.id}" th:text="${c.name}":代码部分为下拉框数据回显