We are using spring as framework and jsp as front end page. I have following code in one of the controller. In the JSP I would like to get value of "selectedRow" which would be a map, and using that map I would like to get the value(which is a set) for a particular key(don't want to iterate the map) and iterate over it.
@Autowired
public NutritionSelection ns;
model.addAttribute("selectedRow", ns.getNutritionDtoList());
@Component
public class NutritionSelection {
Map<String, Set<NutritionDto>> nutritionDtoList;
.......
}
Could some one please help how to achieve this. Thanks in advance, Kitty
You could use EL like so:
<c:set var="myVar" value="${selectedRow['yourkey']}"/>
<!--if your page default scope isn't request then:-->
<c:set var="myVar" value="${requestScope.selectedRow['yourkey']}"/>