@At({"/?/?","/"})
@Ok("re")
public String category(@Param("siteId") String siteId, @Param("categoryId") String categoryId,ViewModel model) {
log.debug("栏目");
CmsSite site = siteService.findById(siteId);
if (site==null)
throw new CmsException("站点未找到!");
CmsCategory category = categoryService.fetch(categoryId);
if (Lang.isEmpty(category))
throw new CmsException("栏目未找到!");
Cnd cnd = Cnd.where("siteId", "=", siteId).
and("categoryId", "=", categoryId);
Page<CmsContent> page = contentService.listPage(1, cnd);
model.setv("title", category.getName());
model.setv("keyword", site.getKeyword());
model.setv("description", site.getDescription());
model.setv("site", site);
model.setv("category", category);
model.setv("page", page);
String viewName = view( site.getTemplate(),category.getIndexTpl());
System.out.println("-------------"+viewName);
return viewName;
}
前台有一个自定义标签貌似得不到传过来的值
<#cms_category_list siteId="${site.id}" categoryId="${category.id}" isNav="0" var="category">
<br>
<a href="${category.url!}">${category.names!}</a>
<br>
</#cms_category_list>
提示
:变量未定义(VAR_NOT_DEFINED):site 位于9行 资源:/templates/www/sjw/index.html
${site.id}这种写法有问题吗?