I'm a beginner trying to learn AEM.
I've a Map<Custom class, Custom Class> from which I'm able to retrieve "Key" but not able to retrieve "Value" in Sightly.
If <div data-sly-list> is used it displays the "Key", but not displaying "Value".
Example :
<div>car class</div>
<div data-sly-use.test="${'Class Name' @ slingreq=request }">
<div data-sly-list.var="${test.getVehFeatures}">Key: ${var.xyz} Value:${test.getVehFeatures[var].name}</div>
</div>
getVehFeatures is of type Map<Custom class, Custom class>
If <div data-sly-attribute > is used, it doesn't display anything.
Please suggest an approach for this in Sightly.
Thanks,
Karthik
Solved! Go to Solution.
Views
Replies
Total Likes
When working with Collections - why not use the Java part of a Sightly component? In this use case - the HashMap. Java has far better control reading a HashMap. Read the HashMap in Java and pass the values back in JSON.
See this community article to learn how to use Java and Sightly together:
https://helpx.adobe.com/experience-manager/using/creating-sightly-component.html
See the Java class that extends WCMUse
Views
Replies
Total Likes
I am using sightly and java together. I am having the same problem. It seems as though sightly syntax does not allow the key of a hashmap to be anything other than a string. In sightly when the key for my hashmap is a string I can make the original posters syntax work. However when I make the key a custom class it not longer works. (I did implement equals and hashcode in my custom class).
I would like to know if its possible to make sightly syntax iterate a hashmap when the key of the hashmap is an custom class.
Thanks
Views
Replies
Total Likes
When working with Collections - why not use the Java part of a Sightly component? In this use case - the HashMap. Java has far better control reading a HashMap. Read the HashMap in Java and pass the values back in JSON.
See this community article to learn how to use Java and Sightly together:
https://helpx.adobe.com/experience-manager/using/creating-sightly-component.html
See the Java class that extends WCMUse
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies