Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Returning list of nested child pages at given path in JSON format. after passing the page path

Avatar

Avatar
Validate 1
Level 2
kalyan_chakrav1
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
kalyan_chakrav1
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
kalyan_chakrav1
Level 2

27-01-2021

Code sample to get the list of nested child pages at a given path in json format using componentexporter

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

274 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

274 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

28-01-2021

@kalyan_chakrav1 

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;
}

Answers (2)

Answers (2)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,348 likes

Total Posts

3,226 posts

Correct Reply

916 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,348 likes

Total Posts

3,226 posts

Correct Reply

916 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

27-01-2021

Please use Page APi in your model to get all the page and create json based on results 

https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/co...

 

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

611 likes

Total Posts

589 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

611 likes

Total Posts

589 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

27-01-2021

@kalyan_chakrav1,

Can you please elaborate on your question? It is not making sense...