3 Replies Latest reply on Dec 21, 2012 10:45 AM by Yogesh Upadhyay

    How to locate a page using relative path in JCR?

    apark2900

      Hi,

       

      I want to know JCR code to locate a certain page using relative path.

       

      Here is my web page structure:

       

      /home/othersBook/article1

      /home/othersBook/article2

      ....

      /home/myBook/article1

      /home/myBook/article2

      ...so on.

       

      Let's say that I am at the root page as "/home" developing a home page.

      At this page, I want to display all the titles of articles in "myBook" folder.

       

      Q: I don't know how can I locate a page of "myBook", so that I can do below code to iterate all the children of that folder.

       

      Page myBook = getPage("/home/myBook");           //**this is not right, but want something like this.

      Iterator<Page> children = myBook.listChildren(new PageFilter(request));

      while (children.hasNext()) {

                  Page child = children.next();

                 out.println(child.getTitle());

      }