Navigation website | Community
Skip to main content
nehat63181151
Level 2
Sep 6, 2019 6:29 AM UTC
Solved

Navigation website

I have created multiple pages as in we-retail site. the pages heading has started displaying in the navigation also in my demo website. But i have read few articles and have found that we can display the navigation using java also.

and using java code to display the navigation is different then how i have done that right now. Can anyone suggest how the navigation will display using java. I have created a project through maven and my crx-de and maven is connected too. Should i use sightly also in this.

Please suggest.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Umesh_Sondhi
Umesh_SondhiAccepted solution
Level 4
Sep 6, 2019 10:20 AM UTC

Hi

For reference you can use the below code

rootPage = getCurrentPage().getAbsoluteParent(2);

        if (rootPage == null) {

        rootPage = getCurrentPage();

        }

       

        Iterator<Page> childPages = rootPage.listChildren(new PageFilter(getRequest()));

    while (childPages.hasNext()) {

items.add(childPages.next());

    }

    }

    // Returns the navigation items

    public List<Page> getItems() {

        return items;

    }

    // Returns the navigation root

    public Page getRoot() {

        return rootPage;

or  to page AEM/TopNav.java at master · pankajchhatri/AEM · GitHub

4 replies

Feb 25, 2020 9:42 AM UTC

Currently, I am using the Garmin App while I am using the navigation system for checking any location via the map. An error occurred when I was trying to deal with Garmin connect login. I could not connect with the GPS system for this error and also could not find the desired location. Need a proper solution for this particular problem.

Translate
Umesh_Sondhi
Umesh_SondhiAccepted solution
Level 4
Sep 6, 2019 10:20 AM UTC

Hi

For reference you can use the below code

rootPage = getCurrentPage().getAbsoluteParent(2);

        if (rootPage == null) {

        rootPage = getCurrentPage();

        }

       

        Iterator<Page> childPages = rootPage.listChildren(new PageFilter(getRequest()));

    while (childPages.hasNext()) {

items.add(childPages.next());

    }

    }

    // Returns the navigation items

    public List<Page> getItems() {

        return items;

    }

    // Returns the navigation root

    public Page getRoot() {

        return rootPage;

or  to page AEM/TopNav.java at master · pankajchhatri/AEM · GitHub

Translate
nehat63181151
Level 2
Sep 6, 2019 10:06 AM UTC

Thanks for the reply but can you plz explain further the page API thing. and the list of child page or any reference link would be appreciated.

Translate
Umesh_Sondhi
Level 4
Sep 6, 2019 7:54 AM UTC

Hi,

You can use the page API and then list the child pages from it  .

Thanks

Translate