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

How to retrieve the node structure of the page in the UI giving the path of the page in aem6.3?

Avatar

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

08-02-2018

I need to retrieve the internal node structure(which is nothing but including the node structure of how the components of the page are stored in the JCR) of the page and render the UI giving the path of the page in aem6.3. Can anyone help me out?

Replies

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

08-02-2018

Try this String nodePath = "/content/community-components/en"; try { Node node = null; NodeIterator nodes =null; String result=""; resource = slingRequest.getResourceResolver().getResource(nodePath);     if(resource != null)     {     node = resource.adaptTo(Node.class);     NodeIterator nodeItr = node.getNodes();             while(nodeItr.hasNext())                 {                 Node cNode = nodeItr.nextNode();                 result=node.getProperty("jcr:primaryType").getValue().getString();                 out.print(result);                 }     } } catch(Exception e) { out.print(e); } or http://keysandstrokes.info/aem-code-snippets-read-child-nodes-aem/

Avatar

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

08-02-2018

Can you please let me know whether retrieval of the data in json format which is achieved using javascript use-api in aem6.3?

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

08-02-2018

use the below js to get page nodes use(function () { var pageName = currentPage.name; var title = currentPage.properties.get("jcr:title"); var resourceName = granite.resource.name; var resourceTitle = properties.get("jcr:title"); return { pageName: pageName, title: title, resourceName: resourceName, resourceTitle: resourceTitle }; }); refer to examples here https://helpx.adobe.com/experience-manager/htl/using/use-api-javascript.html

Avatar

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile

Avatar
Validate 1
Level 7
Hemant_arora
Level 7

Likes

92 likes

Total Posts

290 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 50
View profile
Hemant_arora
Level 7

08-02-2018

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

08-02-2018

What business case are you supporting with this information. Purhaps there is another way to achieve your  requirements.

Avatar

Avatar
Give Back
Level 1
aem_raw
Level 1

Likes

2 likes

Total Posts

7 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Give Back
Level 1
aem_raw
Level 1

Likes

2 likes

Total Posts

7 posts

Correct Reply

1 solution
Top badges earned
Give Back
Validate 1
Boost 1
Affirm 1
View profile
aem_raw
Level 1

08-02-2018

You can create the structure using  "infinity.json". For Example, if the page path is "/content/we-retail/ca/en/men" you can get the data from "/content/we-retail/ca/en/men.infinity.json" by using javascript(ajax call)

Avatar

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

08-02-2018

Screen Shot 2018-02-09 at 11.49.34 AM.png

In the above image 'fr' is the page while giving the path of the page in the UI, it should retrieve the nodes and properties of them in a particular format(preferably in json), Is there anyways to do it using javascript use apis or anyother means?

Avatar

Avatar
Boost 5
Level 2
jagjeetthukral
Level 2

Likes

7 likes

Total Posts

36 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 3
View profile

Avatar
Boost 5
Level 2
jagjeetthukral
Level 2

Likes

7 likes

Total Posts

36 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 3
View profile
jagjeetthukral
Level 2

12-02-2018

Hi Malarvizhi Saravanan​ :

I would suggest you to use AEM's Content Services to achieve what you want.

I is the best solution to your problem, giving you granular control over the data you would like to expose via the API.

Cheers,

Jagjeet

AEM Forms Blog

Avatar

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

Avatar
Validate 1
Level 2
Malarvizhi_Sara
Level 2

Likes

5 likes

Total Posts

15 posts

Correct Reply

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

13-02-2018

Is there any other means to do with JCR Node API to achieve this?