/**
* 当前段控制器把请求转交给此控制器后,会首先调用formBackinigObject方法
* 此方法的作用是根据绑定的Command Class来创建一个Command对象,因此除了可以在构造方法中调用
* setCommandClass方法,也可以在此处调用setCommandClass方法。其实创建这个command对象
* 很简单,spring通过如下代码完成
* BeanUtils.instantiateClass(this.commandClass);
* 由于在此处必须根据commandClass来完成Command对象的创建,因此在此方法调用前应保证commandClass设置完成
* 所以我们可以在formBackingObject方法和构造方法中完成commandClass的设置。
*/
protected Object formBackingObject(HttpServletRequest request) throws Exception{
return super.formBackingObject(request);
}
/**调用initBinder方法,初始化Command对象,即把表单参数与command字段按名称进行匹配赋值。
*/
protected void initBinder(HttpServletRequest request,ServletRequestDataBinder binder) throws Exception{
super.initBinder(request, binder);
}
/**调用onBind方法,把Command对象和后端控制器绑定。
*/
protected void onBind(HttpServletRequest request, Object command){
super.onBind(request, command);
}
/**
* 调用onBindAndValidate方法,验证用户输入的数据是否合法。如果验证失败,我们可以通过修改errors参数
* 即新的errors对象将会绑定到ModelAndView上并重新回到表单填写页面。
*
*
*/
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors){
super.onBindAndValidate(request, command, errors);
}
* 当前段控制器把请求转交给此控制器后,会首先调用formBackinigObject方法
* 此方法的作用是根据绑定的Command Class来创建一个Command对象,因此除了可以在构造方法中调用
* setCommandClass方法,也可以在此处调用setCommandClass方法。其实创建这个command对象
* 很简单,spring通过如下代码完成
* BeanUtils.instantiateClass(this.commandClass);
* 由于在此处必须根据commandClass来完成Command对象的创建,因此在此方法调用前应保证commandClass设置完成
* 所以我们可以在formBackingObject方法和构造方法中完成commandClass的设置。
*/
protected Object formBackingObject(HttpServletRequest request) throws Exception{
return super.formBackingObject(request);
}
/**调用initBinder方法,初始化Command对象,即把表单参数与command字段按名称进行匹配赋值。
*/
protected void initBinder(HttpServletRequest request,ServletRequestDataBinder binder) throws Exception{
super.initBinder(request, binder);
}
/**调用onBind方法,把Command对象和后端控制器绑定。
*/
protected void onBind(HttpServletRequest request, Object command){
super.onBind(request, command);
}
/**
* 调用onBindAndValidate方法,验证用户输入的数据是否合法。如果验证失败,我们可以通过修改errors参数
* 即新的errors对象将会绑定到ModelAndView上并重新回到表单填写页面。
*
*
*/
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors){
super.onBindAndValidate(request, command, errors);
}