Large portion of a developer work in any Web content management tool is to display content. Here are the three ways to do so in AEM/CQ5 -
1. Through Properties Object - The properties object is an instance of the ValueMap class and contains all properties of the current resource. For example -
properties.get("jcr:title")
2. Through Current Page Object – The currentPage object is an instance of the Page class, which provides some methods to access content. For example -
currentPage.getTitle()
3. Through Current Node Object – The currentNode object is an instance of the Node which provides access to content via the getProperty() method. For example -
currentNode.getProperty("jcr:title").getString()
Here is the complete code snippet for trying all these three optionsLet’s test this script by requesting a page in Site Admin that implements this “Page component”.
Thank you!
Comments
Post a Comment