spring 表单提交的时候,属性为整型,页面值为空串时无法转换为空指针 。
在你的派生类里重写commandcontrollor 的initBinder方法
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder)
throws Exception {
binder.registerCustomEditor(Integer.class,new CustomNumberEditor(Integer.class,true));
}
throws Exception {
binder.registerCustomEditor(Integer.class,new CustomNumberEditor(Integer.class,true));
}
可以解决这个问题 ................... spring作者的疏忽么.....