ModelMap 属性未传递值
我遇到了 modelmap 属性的问题..这是我的 xyz.jsp 文件..
<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>
和控制器类...
@RequestMapping(value="index", method = RequestMethod.GET)
public String mainList(ModelMap modelMap){
modelMap.addAttribute("sectionList", sectionService.getAllSectionList());
return "home";
}
但在网页上我没有看到下拉列表中的选项..我看到的只是一个值说“${section.description}”..事实上这是html中的源代码..
<select name="division" >
<option value="-">Choose a Value</option>
<option value="${section.code}">${section.description}</option>
</select>
对我在这里做错了什么有任何帮助吗?谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过
did you try
<c:out value="${section.[attribue]}/>
? otherwise it will be displayed as string.您的 lib 文件夹中似乎没有 jstl-{version}.jar 。
It looks like you dont have jstl-{version}.jar in your lib folder.