0

我有 Spring SimpleFormController 目前适用于 POST 请求。我想将表单提交更改为 GET。所以我把html表单的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>
4

1 回答 1

0

一个简单的:

@Override
protected boolean isFormSubmission(HttpServletRequest request) {
    return true;
}

将告诉它始终遵循控制器的提交工作流程。显然,如果此 URL 中同时存在“提交”和“正常”GET,您将必须检查请求并找出差异!

于 2013-02-05T00:18:25.437 回答