"date"タイプの入力をspring mvc Controllerに送信します。 残念ながら、私は多くのエラーが発生し続けています。私はspring mvcに新しく、とりわけ私がなぜ "commandName"をフォームに持つ必要があるのかを私にはっきりさせずに提出するようにしました。これまでspring mvcアプリケーションで入力タイプ= "date"を送信
マイコード:
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>
コントローラー:あなたは日付を直接結合しotのコントローラ内で@InitBinder使用する必要が
@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";
}
ちょうど私が思う@Rajesh RequestParamの代わりModelAttribute – Rajesh
を使用します" – LoganMzz