标签:public tle tps data 问题 servlet tom 封装 表单提交
三种格式的InitBinder
@InitBinder//https://stackoverflow.com/questions/20616319/the-request-sent-by-the-client-was-syntactically-incorrect-spring-mvc-jdbc-te
public void initBinder(WebDataBinder binder) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
sdf.setLenient(true);
binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));
}
@InitBinder// 弟弟通过qq发送的
public void initBinder(ServletRequestDataBinder binder){
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"),
true));
}
@InitBinder//露露通过飞秋发送的
public void initBinder(ServletRequestDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor(
new SimpleDateFormat("yyyy-MM-dd"), true));
}
[Spring MVC] 表单提交日期转换问题,比如可能导致封装实体类时400错误
标签:public tle tps data 问题 servlet tom 封装 表单提交
原文地址:https://www.cnblogs.com/zienzir/p/9270808.html