我有Spring SimpleFormController,它目前适用于POST请求。 我想将表单提交更改为GET。所以我将html form method =“post”更改为method =“get”。
更改后,我希望调用processFormSubmission方法。 但不是。
你能告诉我这里做错了什么吗?
import org.springframework.web.servlet.mvc.SimpleFormController;
public class VehicleDescController extends SimpleFormController
{
protected ModelAndView processFormSubmission(
final HttpServletRequest request, final HttpServletResponse response,
final Object command, final BindException errors) throws Exception
{
....
}
}
<bean name="/vehicleDesc.html"
class="com.xxx.VehicleDescController">
<property name="commandName" value="lotSeller"/>
<property name="commandClass" value="com.xxx.LotSeller"/>
<property name="formView" value="xxxTheBasics"/>
<property name="viewName" value="xxxVehicleDesc"/>
<property name="imageUploadViewName" value="imageUpload"/>
<property name="vixErrorView" value="xxxVIXError"/>
<property name="assignmentEntryService" ref="xxxService"/>
<property name="referenceDataService" ref="referenceDataService"/>
<property name="xxxReferenceDataService" ref="xxxReferenceDataService"/>
<property name="messageSource" ref="messageSource"/>
<property name="xxxService" ref="xxxService"/>
<property name="validator" ref="xxxEntryValidator"/>
</bean>
答案 0 :(得分:0)
简单:
@Override
protected boolean isFormSubmission(HttpServletRequest request) {
return true;
}
将告诉它始终遵循控制器的提交工作流程。显然,如果此URL中同时存在“提交”和“正常”GET,您将必须检查请求并找出差异!