社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
springmvc 400错误.参数类型不对,或有空值就会出这种错误.
主要是timestamp类型引起
:8080/teasoft/orderHistory/edit:1 Failed to load resource: the server responded with a status of 400 (Bad Request)
timestamp类型经过spingmvc返回数据,影响显示和编辑保存.要在javabean加注解.
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
public Timestamp getDatetime() {
return datetime;
}
====================
// @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Timestamp datetime;
在属性上这个标签是springmvc的,只能解决空值报400问题.不能解决显示和编辑的情况.
为什么这些解决方法都是要污染Javabean呢? 而不是在自己的框架上解决问题??
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!