Expand my Community achievements bar.

SOLVED

Accessing jcr:content property from cq:page

Avatar

Level 5

I have a page where I want to access a node property from that page's jcr:content node

How can I do this? I remember seeing an example using the CQ tag or slightly

An example would be greatly appreciated.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 5

I figured it out, its done like this:

 

<%@include file="/libs/foundation/global.jsp"%>
<%
    String title = properties.get("html", "default title");
%>
<%=title%>

View solution in original post

4 Replies

Avatar

Level 10

A page node under /content only holds markup - like HTL/HTML/JSP. 

To access any node property - you have to use an API like the JCR API. 

For example: 

node.getProperty();

To learn how to use JCR API to access a node prop - see: 

https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html

Hope this helps. 

Avatar

Level 10

Take a look at this doc topic:

https://docs.adobe.com/docs/en/cq/5-6-1/developing/pageinfo.html

It talks about an API you can use to get page information. I have never used that API myself - but it may help you get page info without using a lower level API like JCR API. 

Avatar

Level 5

not the page node, the property within the jcr:content of the page node is what I want to access

/content/MyPage/jcr:content <-- this

I want to access that node from the page...not using any java methods or anything.

I did it before but just can't find the documentation.

Avatar

Correct answer by
Level 5

I figured it out, its done like this:

 

<%@include file="/libs/foundation/global.jsp"%>
<%
    String title = properties.get("html", "default title");
%>
<%=title%>