freemarker動態載入選單
阿新 • • 發佈:2019-02-01
<ul class="nav nav-list"> <#list permission as perm> <li> <a id="" href="#" class="dropdown-toggle tooltip-success" data-rel="tooltip" data-placement="right" title="${perm.menuName}"> <i class="${perm.icon}"></i> <span class="menu-text">${perm.menuName} </span> </a> <b class="arrow"></b> <ul class="submenu"> <#if perm.childrens??> <#list perm.childrens as child> <li id="${child.no}" class=""> <a href="${child.menuUrl}" class="tooltip-success" data-rel="tooltip" data-placement="right" title="${child.menuName}"> <i class="${child.icon}"></i> <span>${child.menuName}</span> </a> <b class="arrow"></b> </li> </#list> </#if> </ul> </li> </#list> </ul><!-- /.nav-list -->
上面的程式碼為整合cas單點登入後在session中獲取permission物件,利用freemarker指令遍歷這個物件,動態載入選單欄。