When iterating on the same loop twice, I got an error:
freemarker.template.SimpleSequence cannot be cast to java.util.List
First Loop
<#assign peopleMap = context.getpeopleMapByGender()>
<#foreach item in peopleMap["man"] >
${item.first_name!"Unknown"} ${item.last_name!"Unknown"}
</#foreach>
Second Loop
<#foreach item1 in peopleMap["man"]>
${item1.address!"Unknown"}
</#foreach>
Is there a way to make it work? What am I doing wrong?
Not sure to be honest. This simple example works. Maybe try and strip your template down and see what happens. I thought
getpeopleMapByGender()might be a typo with lowercasep, but that would mean neither loop would work.example.ftl
Test class
Output