一、 流程简述
Spring接收一个请求,首先判断请求类型是get还是post,
(1)get
<1>创建一个command对象,通过AbstractFormController或SimpleFormController的formBackingObject方法创建。
<2>创建一个ServletRequestDataBinder绑定对象,通过createBinder方法,其中会调用initBinder用于数据格式化。
<3>创建BindException对象,用于存储错误信息。
<4>判断是否为sessionForm,默认false。如果为true则把command对象保存在session中。通过request.getSession().setAttribute(this.getFormSessionAttributeName(request),errors.getTarget());
----key为 “完整类路径”+“.FORM."+"commandName”---- 如com.XXX.AClass.FORM.command
<5>调用AbstractController的referenceData方法,默认返回null,可以重写实现页面下拉框等数据的初始化。