Iterating over collections
When Java code is generated from TCDL variables are automatically created using default names. You can specify your own variable names and use these variables in your TCDL tags, for example if the default variable names conflict with existing names.
- Default variable names
-
By default, the following variable names are used for collections and items in the collections:
Tag Collection variable name Item variable name <tcdl:promotions>promotionspromotion<tcdl:promotionalItems>promotionalItemspromotionalItem<tcdl:items>itemsitem - Declaring a variable
-
Use the
varattribute in the tag exposing the collection to declare your own variable name, for examplevar='myVariableNameForCollection'. - Calling the item collection
-
Use the
itemsattribute on theitemTemplatetag to call the item collection, for exampleitems='myVariableNameForCollection':- In Java code, prefix the variable name with a dollar sign, for example
${items} - In Dreamweaver Templates, prefix the variable name with a hash sign, for example
#{VariableName}
- In Java code, prefix the variable name with a dollar sign, for example