2013-05-18 19 views
0

我有以下的jsp:(春季控制器)通过客户端发送的要求是语法不正确

<form:form method="post" commandName="fare"> 
    <div><fmt:message key="createfares.name" /></div> 
    <div><form:input path="name" type="text"></form:input> </div> 
    <div><fmt:message key="createfares.amount" /></div> 
    <div><form:input path="amount" type="number" min="0" step="0.01"></form:input></div> 
    <div><fmt:message key="createfares.startDate" /></div> 
    <div><input name="startDate" type="date"/> </div> 
    <div><fmt:message key="createfares.endDate" /></div> 
    <div><input name="endDate" type="date"/> </div> 
    <div><fmt:message key="createfares.description" /></div> 
    <form:textarea path="description" cols="125" /> 
    <div><form:errors path="*"/></div> 
    <fmt:message key="modifyfare.note" /> 
    <div class="submit"><input name="submit" type="submit" value="<fmt:message key="tooltip.modifyfare" />"></div> 
</form:form> 

和我有以下控制器:

@RequestMapping(value="/modify/{idFare}", method=RequestMethod.GET) 
public String getModifyFare(@PathVariable String idFare, ModelMap model) 

@RequestMapping(value="/modify/{idFare}", method=RequestMethod.POST) 
public String postModifyFare(@PathVariable String idFare, @ModelAttribute("fare") @Valid Fare fare, ModelMap model, 
     BindingResult result, final RedirectAttributes redirectAttributes, 
     @RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) 

的GET作品完美,但POST始终表示“客户发送的要求在语法上不正确”。

任何人都知道为什么会发生这种情况?

+1

我删除了“ModelMap模型”,我没有在这篇文章中使用,它的工作原理。 –

回答

1

在Controller的处理POST方法的签名中,您同时拥有RedirectAttributes和ModelMap。这两种类型用于在模型中存储变量。他们可能有冲突。尝试删除其中的一个。

相关问题