问题原因,前台表单提交到了Date格式的数据,后台编码时不能识别该日期格式,故而无法进入到Controller就被拦截!
解决方法,在需要进行转换的Controller层加入如下代码,进行初始化转换。
/*
* 表单提交日期绑定
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
此时就可以获取到前台传来的日期类型的数据了。