HTL不需指定任何項目,就可讓您在包含global.jsp
後,存取JSP中常用的所有物件。 這些物件除了可透過Use-API引進的任何物件外。
這些物件可方便存取常用資訊。 其內容可以使用點符號來存取,也可以使用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對象作為備份。
下表中最有用的變數會以粗體反白顯示。
變數名稱 | 說明 |
---|---|
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來支援HTL邏輯。 不過,偏好或建議的方法是使用Sling Models.