我正在尝试创建所有子页面的列表以显示为超链接列表。我让用户选择父文件夹,并且应该相应地列出任何子页面。但是,它出现空白(children
为空)。
对话框元素:
<listRoot
name (String): ./listRoot
jcr:primaryType (Name): cq:Widget
xtype (String): pathfield
>
源代码:
<%@include file="/libs/foundation/global.jsp"%>
<%@page
import="java.util.Iterator,
com.day.cq.wcm.api.PageFilter"
%>
<%@page session="false" %>
<%
String listroot = properties.get("listRoot", currentPage.getPath());
Page rootPage = pageManager.getPage(listroot);
if (rootPage != null) {
Iterator<Page> children = rootPage.listChildren(new PageFilter(request));
while (children.hasNext()) {
Page child = children.next();
String title = child.getTitle() == null ? child.getName() : child.getTitle();
String date = child.getProperties().get("date","");
%><div class="item">
<a href="<%= child.getPath() %>.html"><b><%= title %></b></a>
<span><%= date %></span><br>
<%= child.getProperties().get("jcr:description","") %><br>
</div><%
}
}
%>