Ich möchte einen Eingang des Typs "Datum" an einen Federmvc-Controller übermitteln. Leider bekomme ich immer wieder zahlreiche Fehler. Ich bin neu in der Feder mvc und vor allem in der Einreichung, nicht sehr klar zu mir, warum ich "commandName" in Form haben muss.Submit Input Typ = "Datum" im Frühjahr mvc-Anwendung
Mein Code so weit:
backoffice.jsp:
<form:form method="POST" action="/getAllOnDate" commandName="date">
<table>
<td><form:label path="date">Date</form:label></td>
<td><form:input type="date" path="date"/></td>
<input type="submit" value="View all on date"/>
</table>
</form:form>
Controller:
@RequestMapping(value = "/backoffice", method = RequestMethod.GET)
public String backofficeHome(Model model) {
model.addAttribute("date", new Date());
return "backoffice";
}
@RequestMapping(value = "/getAllOnDate", method = RequestMethod.POST)
public String getAllReservationsForRestaurantOnDate(@ModelAttribute("date") Date date, Model model) {
LOG.info(date.toString());
return "anotherPage";
}
nur RequestParam anstelle von ModelAttribute – Rajesh
@Rajesh ich denke, "View API" -basierte Lösung (JSTL + Modell) angefordert – LoganMzz