Map<String,List<String>> test=new HashMap<String, List<String>>();
List<String> temp1=new ArrayList<String>();
int i=1;
for(DoMenu l:menuList){
List<String> temp=new ArrayList<String>();
temp.add("submenu "+(i++));
temp.add("submenu "+(i++));
temp.add("submenu "+(i++));
test.put(l.getMenuId().toString(), temp);
}
model.addAttribute("test1", test);
in jsp :
var categoryData='${test1}';
$.each(categoryData, function(key,value) {
if(key==categoryName){
for(var i=0;i<value.length;i++){
markup += "<li><a href='#servicepage?submenuId=196'> " + value[i] + "</a></li>";
}
}
I tried the above but
it is not working......but I print the categoryData I got the following data......
{202=[submenu 4, submenu 5, submenu 6], 212=[submenu 10, submenu 11, submenu 12], 232=[submenu 19, submenu 20, submenu 21], 229=[submenu 16, submenu 17, submenu 18], 217=[submenu 13, submenu 14, submenu 15], 196=[submenu 1, submenu 2, submenu 3], 209=[submenu 7, submenu 8, submenu 9]}
please help me how to iterate the above data in jquery............