问题
I am having issues with modelmap attributes.. this is my xyz.jsp file..
<select name="list">
<option value="-">Choose a Value</option>
<c:forEach items="${sectionList}" var="section">
<option value="${section.code}">${section.description}</option>
</c:forEach>
</select>
and the controller class...
@RequestMapping(value="index", method = RequestMethod.GET)
public String mainList(ModelMap modelMap){
modelMap.addAttribute("sectionList", sectionService.getAllSectionList());
return "home";
}
But on the web page I don't see the options in the drop down.. All I see is only one value saying "${section.description}".. infact this is the source in html..
<select name="division" >
<option value="-">Choose a Value</option>
<option value="${section.code}">${section.description}</option>
</select>
Any help on what am I doing wrong here? Thanks!
回答1:
did you try <c:out value="${section.[attribue]}/>
? otherwise it will be displayed as string.
回答2:
It looks like you dont have jstl-{version}.jar in your lib folder.
来源:https://stackoverflow.com/questions/6970897/modelmap-attribute-not-passing-the-value