@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 myModels
list into the ModelMap
to be passed to the "index" view. How do I then access those MyModel
objects from the JSTL code?
Is it necessary for this controller method to be final
and for the ModelMap
parameter to be final
?
By name, eg <c:out value="${mymodel}"/>
. Every model attribute you add to the ModelMap
is made available as a JSP request-scoped attribute.
"no" and "no", final
is irrelevant here - did someone tell you otherwise?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.