我想在Spring中使用jslt打印一个多级列表,如何对控制器和jsp进行编码?
这是我的控制器代码:
@RequestMapping(value = "/index.htm", method = RequestMethod.GET)
public String loadHomePage(ModelMap map) {
List<NewsCategory> cat = newsService.getNewsCat();
for(NewsCategory c : cat){
List<News> list = newsService.getByCat(c.getId());
map.put("list-" + c.getId(), list); // is this right?
}
map.put("newscat", cat);
// And how to print these in the jsp page?
return "index";
}谢谢!
发布于 2013-11-25 07:39:58
<c:forEach var="entry" items="${myMap}">
List name: <c:out value="${entry.key}"/>
<c:forEach items="${entry.value}" var="cat" varStatus="rowStatus">
<c:forEach items="${cat.itemList}" var="item" varStatus="rowCount">
<div>...<c:out value="${item.description}"/></div>
</c:forEach>
</c:forEach>
</c:forEach> https://stackoverflow.com/questions/20184015
复制相似问题