@ModelAttribute("mymodel") を定義しました
@ModelAttribute("mymodel")
MyModel mymodel() {
MyModel mymodel = new MyModel();
return mymodel;
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public final void save(@ModelAttribute("mymodel") MyModel mymodel,
final BindingResult binding,
final HttpServletRequest request,
final ModelMap modelMap) throws Exception {
modelService.save(mymodel);
// try to reset the model --> doesn't work!!!
myModel = new MyModel();
}
問題は、save メソッドでモデルをリセットしても、保存操作の後にページをリロードして 2 回目の保存を行うと、モデルには前の のすべての値が含まれることですmyModel
。
処理後にリセットするにはどうすればよいですか?