前后端交互常见问题(SpringBoot)
前言:这是我在学习springboot时所遇到的一些大大小小问题,希望能通过记录学习过程中遇到的问题来见证自己的成长XD,也希望能帮到你。
thymeleaf实现时间格式转换、下拉框回显:
时间格式转换
<td th:text="${#dates.format(bill.billTime,'yyyy-MM-dd')}">1</td>
<select name="typeId" id="typeId" class="form-control">
<option value="0">全部</option>
<option th:each="type:${types}" th:object="${type}"
th:text="*{name}" th:selected="${typeId}==${type.id}"
th:value="*{id}">
</option>
</select>
SpringBoot前端返回的时间数据无法被识别
error:
Field error in object 'bill' on field 'billTime': rejected value [2017-06-25];
codes[typeMismatch.bill.billTime,typeMismatch.billTime,typeMismatch.java.util.
Date,typeMismatch];arguments[org.springframework.context.support.DefaultMessag
eSourceResolvable: codes [bill.billTime,billTime]; arguments [];