ModelMap属性未传递值 [英] ModelMap attribute not passing the value

查看:66
本文介绍了ModelMap属性未传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的模型图属性有问题.这是我的xyz.jsp文件.

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>

和控制器类...

 @RequestMapping(value="index", method = RequestMethod.GET)
  public String mainList(ModelMap modelMap){
     modelMap.addAttribute("sectionList", sectionService.getAllSectionList());
     return "home";
  }

但是在网页上,我没有看到下拉菜单中的选项..我所看到的只是一个值,上面写着"$ {section.description}".事实上,这是html中的来源. >

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!

推荐答案

您尝试了<c:out value="${section.[attribue]}/>吗?否则它将显示为字符串.

did you try <c:out value="${section.[attribue]}/>? otherwise it will be displayed as string.

这篇关于ModelMap属性未传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆