ModelMap attribute not passing the value

ぐ巨炮叔叔 提交于 2019-12-11 10:23:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!