HTL Variables

HTL Variables

Variables holds the data values or objects.

Below given the list of all objects which can be accessed to HTL.

--Enumerable-- --Java-backed--
properties pageProperties inheritedPageProperties component componentContext currentDesign currentNode currentPage currentSession currentStyle designer editContext log out pageManager reader request resolver resource resourceDesign resourcePage response sling slyWcmHelper wcmmode xssAPI

We can access the properties of variable in two ways .

1)Dot notation: simpler,preferred for most cases.
//access the page title

2)Bracket notation: to access properties dynamically or to access properties that contain invalid identifier characters.
//access the page title
${currentPage['title']} or ${currentPage["title"]}

Thumb rule for valid names
 start with a letter (A-Z and a-z), or an underscore (_), and subsequent characters can also be digits (0-9) or colon (:).

Access unicode or invalid identifier characters
${properties['title propertyå']

Access Members Dynamically

Access variables which has 'Null' Values


Go to HTL Tutorial Home page

No comments:

Post a Comment