HTL グローバルオブジェクト htl-global-objects

何も指定しなくても、HTL では開発者に役立つ多くのオブジェクトにアクセスできます。これらのオブジェクトは、Use-API を通じて導入される可能性のあるオブジェクトに追加して提供されます。

NOTE
AEM での JSP 開発に詳しい開発者は、global.jsp を含めると、 HTL を使用して JSP で一般的に使用できるすべてのオブジェクトにアクセスできます。

可算オブジェクト enumerable-objects

これらのオブジェクトを使用すると、よく使用する情報に便利にアクセスできます。コンテンツにはドット表記でアクセスでき、data-sly-list または data-sly-repeat を使用して反復処理できます。

変数名
説明
ベース
properties
現在のリソースのプロパティリスト
org.apache.sling.api.resource.ValueMap
pageProperties
現在のページのページプロパティリスト
org.apache.sling.api.resource.ValueMap
inheritedPageProperties
現在のページの継承されたページプロパティリスト
org.apache.sling.api.resource.ValueMap

Java ベースのオブジェクト java-backed-objects

次に示す各オブジェクトは、対応する Java オブジェクトをベースとします。

変数名
説明
component
com.day.cq.wcm.api.components.Component
componentContext
com.day.cq.wcm.api.components.ComponentContext
currentContentPolicy
com.day.cq.wcm.api.policies.ContentPolicy
currentContentPolicyProperties
com.day.cq.wcm.api.policies.ContentPolicy
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 ベースのオブジェクト javascript-backed-objects

HTL ロジックを JavaScript でバックアップすることもできます。ただし、好ましい、推奨される方法は、Sling モデルを使用することです。

recommendation-more-help
86859df1-0285-4512-b293-0ef9cbea5ee8