在controller中通过ModelAndView返回到页面的值,在jsp页面怎么取不到值呢?
controller代码如下
@RequestMapping(value="/courseinfo.do", method=RequestMethod.GET)
public ModelAndView courseinfo(int courseAutoid,int categoryAutoid,int learnrecAutoid,String typeKey){
List<Category> list=categoryService.getParents(categoryAutoid);
List<Category> cateList=Tools.sortOrder(list);
Map<String, Object> map=new HashMap<String, Object>();
map.put("cateList", cateList);
ModelAndView mav=new ModelAndView("student/course/courseinfo");
mav.addObject(map);
return mav;
}jsp:
<c:forEach var="category" items="${cateList}" varStatus="state">
${category.cateName}
<c:if test="${!state.last}">
>
</c:if>
</c:forEach>
controller代码如下
@RequestMapping(value="/courseinfo.do", method=RequestMethod.GET)
public ModelAndView courseinfo(int courseAutoid,int categoryAutoid,int learnrecAutoid,String typeKey){
List<Category> list=categoryService.getParents(categoryAutoid);
List<Category> cateList=Tools.sortOrder(list);
Map<String, Object> map=new HashMap<String, Object>();
map.put("cateList", cateList);
ModelAndView mav=new ModelAndView("student/course/courseinfo");
mav.addObject(map);
return mav;
}jsp:
<c:forEach var="category" items="${cateList}" varStatus="state">
${category.cateName}
<c:if test="${!state.last}">
>
</c:if>
</c:forEach>
解决方案 »
- ext 更新后怎么去加载页面?
- Java SSH项目配置文件的调用过程
- extjs动态加载树
- 菜鸟问题:SQL2005连接问题
- 您好,我想用java做一个简单的电子地图,哪位高手能提供小弟一些帮助,最好能有完整的代码....万分感激
- 正则替换标签急问
- 达人指教:未学习JAVA土人一名,现需要用JAVA编制WEB应用程序,该如何学起?
- 看看我的这个过滤器有什么问题,浏览器出现死了的状态!
- 采用window.open后的页面,为什么SEESION无法传递到页面上?
- 哇!!!我终于通过servlet调用地成功enterprise java beans啦!!!我太兴奋了!!!!!噢~!!!
- java web session能不能设置不同过期时间
- 求助大虾,极光推送,本地服务器向手机发送推送对象报错
获取到了数据没有断点看一下!
试试
这样返回,jsp页面就有数据了
List<Category> cateList=Tools.sortOrder(list);2、mav.addObject(map); 这个方法换一下
return new ModelAndView("student/course/courseinfo",map);