ハイパーリンクされたリストとして表示するすべての子ページのリストを作成しようとしています。ユーザーに親フォルダーを選択してもらい、それに応じて子ページを一覧表示する必要があります。ただし、空白(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><%
}
}
%>