<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"
th:selected="${dict.dictValue == saleList.warrantyPeriod} ">
</option>
这是循环输出一个下拉框,并且设置回显默认值。当下拉框的数值等于后台传来的数值的时候,等于true。
${dict.dictValue == saleList.warrantyPeriod}
这么写是返回false,原因两边的数据类型不一致。是左边是字符串,右边是数值型。
解决: 在右边加上一个空字符串转成字符串
"${dict.dictValue == ((saleList.warrantyPeriod)+'')} "