Without having to specify anything, HTL provides access to all objects that were commonly available in JSP after including global.jsp. These objects are in addition to any that may be introduced through the Use-API.

Enumerable Objects

These objects provide convenient access to commonly used information. Their content can be accessed with the dot notation, and they can be iterated-through using data-sly-list or data-sly-repeat.

Variable Name Description
properties List of properties of the current Resource.
Backed by org.apache.sling.api.resource.ValueMap
pageProperties List of page properties of the current Page.
Backed by org.apache.sling.api.resource.ValueMap
inheritedPageProperties List of inherited page properties of the current Page.
Backed by org.apache.sling.api.resource.ValueMap

Java-backed Objects

Each of the following objects is backed by the corresponding Java object.

The most useful variables in the table below are highlighted in bold.

Variable Name Description  
component com.day.cq.wcm.api.components.Component  
componentContext com.day.cq.wcm.api.components.ComponentContext  
currentDesign com.day.cq.wcm.api.designer.Design  
currentNode javax.jcr.Node  
currentPage com.day.cq.wcm.api.Page  
currentSession javax.servlet.http.HttpSession  
currentStyle com.day.cq.wcm.api.designer.Style  
designer com.day.cq.wcm.api.designer.Designer  
editContext com.day.cq.wcm.api.components.EditContext  
log org.slf4j.Logger  
out java.io.PrintWriter  
pageManager com.day.cq.wcm.api.PageManager  
reader java.io.BufferedReader  
request org.apache.sling.api.SlingHttpServletRequest  
resolver org.apache.sling.api.resource.ResourceResolver  
resource org.apache.sling.api.resource.Resource  
resourceDesign com.day.cq.wcm.api.designer.Design  
resourcePage com.day.cq.wcm.api.Page  
response org.apache.sling.api.SlingHttpServletResponse  
sling org.apache.sling.api.scripting.SlingScriptHelper  
slyWcmHelper com.adobe.cq.sightly.WCMScriptHelper  
wcmmode com.adobe.cq.sightly.SightlyWCMMode  
xssAPI com.adobe.granite.xss.XSSAPI  

JavaScript-backed Objects

There are also objects available that are backed by JavaScript. However, as of AEM 6.2 these objects are still experimental and it is better to use the Java-backed objects, which allow to do the same.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy