页面使用时间插件致使http 400错误

页面使用jquery是采用了时间插件,后台采用的是springMVC,直接请求的时候会报400错误,这是由于没有使用时间格式转换,使用时间的时候可使用以下的代码进行转换,格式须要根据页面格式来进行转换jquery

@InitBinder
public void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
相关文章
相关标签/搜索