Skip to main content

Reading content from AEM CRX


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 options


Let’s test this script by requesting a page in Site Admin that implements this “Page component”.
image
Thank you!

Comments

Popular posts from this blog

A case for 'strategy' in Digital Strategy...

I recently finished a book named 'Digital Strategy' by Alexander Rauser. Alexander has given current day problems during any Digital transformation and pragmatic solutions for that. Having worked in the IT industry for 17 years and last 10 years mostly into Digital Transformations for most of the fortune 500 companies, it was quite relevant to me. If you are also part of any digital transformation of any organization in any capacity, you will find it helpful too. Over the last decade, companies have thought of digital strategy as a means to market new technology or recognize upcoming trends. However, today few of those companies do realize that Digital Strategy is all about continuously improving your business to stay ahead in the curve, but some are still stuck in the old mindset. It's surprising to see  'Strategy' is missing from the Digital Strategy for many of the transformations happening, rather the focus is just on 'Marketing' (Digital Marketing...

Comparing two AEM installations

There are many situations when you need to compare two AEM instances. The easiest approach is to compare packages, bundles and configurations. Here is how you can do it - Compare package managers  http://localhost:4502/crx/packmgr/service.jsp?cmd=ls Compare Bundles  http://localhost:4502/system/console/bundles.json Compare Configurations  http://localhost:4502/system/console/status-Configurations Compare system properties  http://localhost:4502/system/console/status-System%20Properties You can then compare these manually using any text comparers. Another quicker approach is to compare those using below tools by Aemstuff.com - http://www.aemstuff.com/tools/cti.html http://www.aemstuff.com/tools/coi.html

Some SDL Tridion Interview Questions…

Many of my friends keep asking me to provide some interview questions related with SDL Tridion . Surprisingly, there are hardly any site available for questions related with SDL Tridion., though you can find host of sites for other WCMs like AEM and Sitecore. Hence, I thought to put some basic Tridion related questions on the basis of my experience with it. I know it may require several improvements but thought to share something for someone who is looking to get some Tridion related questions to start with. I will be glad to incorporate any suggestion you have. Development phases related questions - What is the development methodology recommended by SDL for development/integration based on SDL Tridion? Have you participated in any Blueprinting workshop, please share the experience? What are the inputs required in BluePrint? How can inheritance of content flow be altered explicitly? What are priority and ranking in Blueprint? What are the inputs required for Content Modeling ...