如下代码,访问/inPiecesQueryList时,initBinder方法不执行。
但如果把方法inPiecesQueryList(HttpServletRequest request)改为inPiecesQueryList(String str,HttpServletRequest request),initBinder方法就可以执行了。
这是什么原因呢?
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
/**
* 自动转换日期类型的字段格式
*/
binder.registerCustomEditor(Date.class, new CustomDateEditor(
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
}
@RequestMapping(value = "/inPiecesQueryList", method = RequestMethod.POST)
public @ResponseBody DataGrid inPiecesQueryList(HttpServletRequest request)
{
DataGrid dataGrid = new DataGrid();
return dataGrid;
}
但如果把方法inPiecesQueryList(HttpServletRequest request)改为inPiecesQueryList(String str,HttpServletRequest request),initBinder方法就可以执行了。
这是什么原因呢?