How to iterate Map in sightly? | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

You could do something like this:

<div data-sly-list="${customPage.map.keySet}">
${item}
</div>

3 replies

Feike_Visser1
Adobe Employee
Adobe Employee
October 16, 2015

Do you have an example?

Dinu_Arya
Dinu_AryaAuthor
Level 6
October 16, 2015

Feike,

Actually as per my requirements my sightly java class will have a HashMap in which I'm storing some data which I need to display in a page. How can I iterate Map in sightly to get this data? you can just provide me solution for the below HashMap. I will apply the same to my HashMap.

Map map = new HashMap();

map.put(1, "One");

map.put(2, "Two");
map.put(3, "Three");

I checked the tutorials as well I didn't find solution for Map :( .

Thanks,

AryA.

Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

You could do something like this:

<div data-sly-list="${customPage.map.keySet}">
${item}
</div>