Ich bekomme HTTP-Status 400. Die Anfrage vom Client gesendet wurde syntaktisch falsch. Was ich tue ist, nur Bearbeitungsformular in Datenbank zu speichern, aber Anfrage nicht zu saveApplication
Methode gehen. Spring MVC Formular geben HTTP-Status 400
Das folgende ist mein edit.jsp
:
<div align="center">
<h1>New/Edit Contact</h1>
<form:form action="saveApplication" method="post" modelAttribute="application">
<table>
<form:hidden path="applicationId"/>
<tr>
<td>Application Name:</td>
<td><form:input path="applicationName" /></td>
</tr>
<tr>
<td>Start Date:</td>
<td><form:input path="startDate" id="startDate"/></td>
</tr>
<tr>
<td>End Date:</td>
<td><form:input path="endDate" id="endDate"/></td>
</tr>
<tr>
<td>Projected StartDate:</td>
<td><form:input path="projectedStartDate" id="projectedStartDate"/></td>
</tr>
<tr>
<td>Projected EndDate:</td>
<td><form:input path="projectedEndDate" id="projectedEndDate"/></td>
</tr>
<tr>
<td>Current Action:</td>
<td><form:input path="currentAction" /></td>
</tr>
<tr>
<td>Comments:</td>
<td><form:input path="comments" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Save"></td>
</tr>
</table>
</form:form>
</div>
Folgende sind Methoden in meinem Controller-Klasse:
@RequestMapping(value = "/editApplication", method = RequestMethod.GET)
public ModelAndView editApplication(HttpServletRequest request) {
ModelAndView model = new ModelAndView();
int applicationId = Integer.parseInt(request.getParameter("id"));
ApplicationTO to = applicationService.getApplication(applicationId);
model.addObject("application", to);
model.setViewName("edit");
return model;
}
@RequestMapping(value = "/saveApplication", method = RequestMethod.POST)
public ModelAndView saveContact(@ModelAttribute ApplicationTO application) {
ModelAndView model = new ModelAndView();
applicationService.saveApplication(application);
model.setViewName("view");
return model;
}
Ich habe oben hat man versucht, seine Angabe HTTP-Status 404 -/saveApplication – ASR
seine wie diese geben Theurl, wenn ich http einreichen: // localhost: 8080/saveApplication (für die oben genannte Lösung) und dessen keine Protokolle zeigt, – ASR
Spring verwendet starke Namenskonvention ... Können Sie innerhalb des Controllers anstelle der Anwendung versuchen, verwenden Sie ApplicationId wie im Formular? – OEH