我有以下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 总是说“客户端发送的要求在语法上不正确”。
有谁知道为什么会这样?