(Spring controller)客户端发送的要求在语法上不正确
我有以下jsp:(Spring controller)客户端发送的要求在语法上不正确,spring,jsp,spring-mvc,controller,Spring,Jsp,Spring Mvc,Controller,我有以下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:messa
<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>
GET工作得很好,但帖子总是说“客户发送的需求在语法上是不正确的”
有人知道为什么会发生这种情况吗?在控制器处理POST的方法的签名中,您同时拥有重定向属性和模型映射。这两种类型用于在模型中存储变量。他们可能有冲突。尝试删除其中的一个。我已经删除了我在本文中没有使用的“ModelMap model”,它可以正常工作。
@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)