@RequestMapping(value = "/index", method = RequestMethod.GET)
public final String index(final ModelMap model)
{
List myModels = ArrayList<MyModel>(getMyModels());
model.addAttribute("mymodel", myModels);
return "index";
}
-
In Spring I put the
myModelslist into theModelMapto be passed to the “index” view. How do I then access thoseMyModelobjects from the JSTL code? -
Is it necessary for this controller method to be
finaland for theModelMapparameter to befinal?
By name, e.g
<c:out value="${mymodel}"/>. Every model attribute you add to theModelMapis made available as a JSP request-scoped attribute.“no” and “no”,
finalis irrelevant here – did someone tell you otherwise?