Map modelMap = modelAndView.getModel();
I want to retrieve all the keys in the modelMap object , so that i can access each values , these values can be assigned to variables/objects created in the controller class itself
ModelMap subclasses LinkedHashMap
which in turns extends HashMap
The generic type of ModelMap is fixed at Map<String, Object>
So you can iterate through the keys of a map as in HashMap
, you can use keyset() or entryset()
for (Map.Entry<String, Object> entry : map.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
*