[Spring Boot]@ModelAttributeアノテーションのサンプル
1.Controller側クラスの作成
@ModelAttribute
UserForm setUpForm(){
return new UserForm();
}
@RequestMapping(value ="/",method =RequestMethod.GET)
public ModelAndView index(ModelAndView ma) {
ma.setViewName("index");
ma.addObject("userLst",new UserForm());
return ma;
}
2.テンプレートファイル
<form method="post" action="/User/find" th:object="${userList}">