freemarker map嵌套

Menu menu1 = new Menu();

menu1.setMenuName("menu");

menu1.setMenuUrl("url");

 

Menu menu2 = new Menu();

menu2.setMenuName("menu");

menu2.setMenuUrl("url");

 

List list = new ArrayList();

Menu subMenu1 = new Menu();

subMenu1.setMenuName("submenu");

subMenu1.setMenuUrl("url");

 

Menu subMenu2 = new Menu();

subMenu2.setMenuName("menu");

subMenu2.setMenuUrl("url");

 

 

list.add(subMenu1);

list.add(subMenu2);


map.put(menu1,list);

map.put(menu2,list);

 

request.setAttribute("menuMap",map);

 

 

 

在页面jsp中使用freemarker标签

<#list menuMap?keys as menuKeys>

       <li>${menuKeys.name}</li>

      <ul>

          <#assign values_ = menuMap[menuKeys]>
           <#list values_ as menu>
            <li>
                    ${menu.menuName }
             </li>
              </#list>

            报错

           Expression menuKey.memuName is undefined on line 17, column 51 in jsp/freemarker/menu.jsp.
          The problematic instruction:
         ----------
             ==> ${menuKey.memuName } [on line 17, column 49 in jsp/freemarker/menu.jsp]
             ----------

          Java backtrace for programmers:
          ----------
              freemarker.core.InvalidReferenceException: Expression menuKey.memuName is undefined on line 17, column  51 in jsp/freemarker/menu.jsp.
    at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
    at freemarker.core.Expression.getStringValue(Expression.java:118)
    at freemarker.core.Expression.getStringValue(Expression.java:93)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:208)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:208)




 

 

 

            在这里怎样遍历menuMap中value的值......

     </ul>

</#list>



评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值