freemarker里object集合的map取值
谨做笔记,以防忘记:
public class Category{ private Long catId;private String catName;private String cateSn;}?
?
Map<String,Category> categoryMap = categoryManager.getCategoryMap();propMap.put("categoryMap",categoryMap);freeMarkerSingleton.buildHtml("goods_list.ftl", propMap, directory, htmlFileName);?
?
goods_list.ftl:
<div class="position">首页 <#list navList as category>> <a href="${ctx}/goodslist/cateList-${categoryMap[category.cateSn].cateSn}/shopPrice-asc-1.jsp">${category.catName}</a></#list></div>?