I want to loop over the MultiMap in Freemarker template and access(display) the key and its distinct values(which are objects in this case):
Here TaskType is a String (dont misunderstand)
multiMap.put(TaskType.DHOLDING_TASK,Obj1);
multiMap.put(TaskType.BTRADE_TASK,Obj2);
multiMap.put(TaskType.ANONE,Obj3);
multiMap.put(TaskType.DHOLDING_TASK,Obj4);
multiMap.put(TaskType.CPRICE_TASK,Obj5);
multiMap.put(TaskType.BTRADE_TASK,Obj6);
multiMap.put(TaskType.ANONE,Obj7);
multiMap.put(TaskType.CPRICE_TASK,Obj8);
The output will look like this of teh MultiMap:
{CPRICE_TASK=[Obj5, Obj8], ANONE=[Obj3, Obj7], BTRADE_TASK=[Obj2, Obj6], DHOLDING_TASK=[Obj1, Obj4]}
My freeMarker code :
<#assign taskKeys = multiMap?keys >
<#list taskKeys as key>
${key} --It works fine till here :-)
`taskList[key] or taskList[key_values]---XXX both gives exception
How to display the multivalues associated with the key here in list???
I need to access the value part o fthe pair here(i.e. the RHS) : CPRICE_TASK=[Obj5, Obj8]
A help is much appreciated :)
taskList[key]?join(', ')(or#listit). - ddekany