DocumentationAEMHTL Guide

HTL Global Objects

Last update: October 7, 2024
  • Topics:
  • Developer Tools

CREATED FOR:

  • Developer

Without having to specify anything, HTL provides access to many objects useful to the developer. These objects are in addition to any that may be introduced through the Use-API.

NOTE
For developers familiar with JSP development in AEM, HTL provides access to all objects that were commonly available in JSP after including global.jsp.

Enumerable Objects

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

Variable NameDescriptionBacked By
propertiesList of properties of the current resourceorg.apache.sling.api.resource.ValueMap
pagePropertiesList of page properties of the current pageorg.apache.sling.api.resource.ValueMap
inheritedPagePropertiesList of inherited page properties of the current pageorg.apache.sling.api.resource.ValueMap

Java-backed Objects

The corresponding Java object backs each of the following objects.

Variable NameDescription
componentcom.day.cq.wcm.api.components.Component
componentContextcom.day.cq.wcm.api.components.ComponentContext
currentContentPolicycom.day.cq.wcm.api.policies.ContentPolicy
currentContentPolicyPropertiescom.day.cq.wcm.api.policies.ContentPolicy
currentDesigncom.day.cq.wcm.api.designer.Design
currentNodejavax.jcr.Node
currentPagecom.day.cq.wcm.api.Page
currentSessionjavax.servlet.http.HttpSession
currentStylecom.day.cq.wcm.api.designer.Style
designercom.day.cq.wcm.api.designer.Designer
editContextcom.day.cq.wcm.api.components.EditContext
logorg.slf4j.Logger
outjava.io.PrintWriter
pageManagercom.day.cq.wcm.api.PageManager
readerjava.io.BufferedReader
requestorg.apache.sling.api.SlingHttpServletRequest
resolverorg.apache.sling.api.resource.ResourceResolver
resourceorg.apache.sling.api.resource.Resource
resourceDesigncom.day.cq.wcm.api.designer.Design
resourcePagecom.day.cq.wcm.api.Page
responseorg.apache.sling.api.SlingHttpServletResponse
slingorg.apache.sling.api.scripting.SlingScriptHelper
slyWcmHelpercom.adobe.cq.sightly.WCMScriptHelper
wcmmodecom.adobe.cq.sightly.SightlyWCMMode
xssAPIcom.adobe.granite.xss.XSSAPI

JavaScript-backed Objects

It is possible to back HTL logic with JavaScript. However, the preferred or recommended method is by using Sling Models.

NOTE
The JavaScript Use API has been deprecated for use with AEM as a Cloud Service. Please use the Java Use API instead.
Please see the AEM as a Cloud Service release notes for more information on deprecated and removed features.
recommendation-more-help
86859df1-0285-4512-b293-0ef9cbea5ee8