Solved
Returning list of nested child pages at given path in JSON format. after passing the page path
Code sample to get the list of nested child pages at a given path in json format using componentexporter
Code sample to get the list of nested child pages at a given path in json format using componentexporter
Check the below code snippet, hope this is what you are expecting.
@SlingObject
ResourceResolver resourceResolver;
@Self
SlingHttpServletRequest request;
private List<String> children = new ArrayList<String>();
private String root = "/content/test";
@PostConstruct
protected void initialize() {
Page rootPage = resourceResolver.getResource(root).adaptTo(Page.class);
Iterator<Page> listChildren = rootPage.listChildren(null, true);
while(listChildren.hasNext()) {
children.add(listChildren.next().getPath());
}
}
public List<String> getChildren() {
return children;
}
public String getRoot() {
return root;
}Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.