Vivek Dhiman
Vivek Dhiman

Reputation: 1997

Access jcr:content propeties from page node

I have dropdown where the values of options are like jcr:content/jcr:title, jcr:content/jcr:description, /jcr:content/par/entry/text etc. Here the last one is the property of parent, like jcr:title is the property of jcr:content node & text is the property of entry node, but entry has parent par and par has parent jcr:content. I am at the page node and using the below code to fetch such values which doesn't work :

        Node n = (Node)nodeIter.next();
        log.info(n.getProperty("/jcr:content/par/entry/text"));

Any Idea how to get values in such a way.

Thanks

Upvotes: 2

Views: 2255

Answers (1)

Tomek Rękawek
Tomek Rękawek

Reputation: 9304

Remove the starting slash from the property path. It makes the path absolute while you are interested in the relative one (as in other examples you've described):

n.getProperty("jcr:content/par/entry/text");

Upvotes: 4

Related Questions