How do I keep a ModelMap form between forms?
I add to ModelMap
a Map
which contains the list to navigate down. I fill in the ModelAttribute when the form is initialized:
@RequestMapping(method = RequestMethod.GET)
public String initForm(HttpServletRequest httpRequest, ModelMap model)
{
model.addAttribute("myList", myMap);
return "MyForm";
}
It works as expected, however, when the user submits the form this list is lost from the map.
@RequestMapping(method = RequestMethod.POST, value ="/dosearch")
public String processSearch(... ModelMap model)
{
.....
return new ModelAndView("MyForm",model);
This approach above doesn't work.
How can I transfer the map between form submissions?
+3
source to share