Freemarker 트리 탐색 메뉴 생성(귀속)

10675 단어 freemarker
많은 네비게이션 메뉴는 나무 모양, 즉 1급과 1급을 아래로 나누는데 이런 구조는 물론 귀속으로 처리해야 한다. 
Freemarker의 경우 매크로는 서명 및 매개변수 목록을 정의하는 함수에 해당합니다. 
그래서 freemarker 페이지에는 다음과 같이 써야 합니다.
        
            
                
                    
                        
                            
                        
                        
                
                ${menu.menuName!}
                
                        
                        
                        ${menu.url!}
                        
                        
                        ${menu.permissionText!}
                        
                        
                        ${menu.sortNo!}
                        
                        
                            [ ]
                        
                    
                
                    
                #if>
                #list>
            #if>
        #macro>
        
    

백그라운드 데이터:
[
    {
        "id": 1, 
        "enable": true, 
        "remark": null, 
        "createBy": 1, 
        "createTime": 1503546411000, 
        "updateBy": 1, 
        "updateTime": 1503546415000, 
        "keyword": null, 
        "menuName": " ", 
        "menuType": 1, 
        "parentId": null, 
        "iconcls": null, 
        "url": null, 
        "expand": null, 
        "sortNo": null, 
        "permission": null, 
        "moduleId": 1, 
        "parentName": null, 
        "leaf": 0, 
        "typeName": null, 
        "permissionText": null, 
        "menuBeans": [
            {
                "id": 7, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 1, 
                "iconcls": null, 
                "url": "/module/list", 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 3, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 1, 
                "iconcls": null, 
                "url": "/menu/list", 
                "expand": null, 
                "sortNo": null, 
                "permission": "admin:add", 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }
        ]
    }, 
    {
        "id": 2, 
        "enable": true, 
        "remark": null, 
        "createBy": 1, 
        "createTime": 1503546411000, 
        "updateBy": 1, 
        "updateTime": 1503546415000, 
        "keyword": null, 
        "menuName": " ", 
        "menuType": 1, 
        "parentId": null, 
        "iconcls": null, 
        "url": null, 
        "expand": null, 
        "sortNo": null, 
        "permission": null, 
        "moduleId": 1, 
        "parentName": null, 
        "leaf": 0, 
        "typeName": null, 
        "permissionText": null, 
        "menuBeans": [
            {
                "id": 9, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": null, 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 8, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": null, 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 6, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": "/user/list-6", 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 5, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": "/user/list-5", 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 4, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": "/user/add-4", 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }, 
            {
                "id": 10, 
                "enable": true, 
                "remark": null, 
                "createBy": 1, 
                "createTime": 1503546411000, 
                "updateBy": 1, 
                "updateTime": 1503546415000, 
                "keyword": null, 
                "menuName": " ", 
                "menuType": 1, 
                "parentId": 2, 
                "iconcls": null, 
                "url": null, 
                "expand": null, 
                "sortNo": null, 
                "permission": null, 
                "moduleId": 1, 
                "parentName": null, 
                "leaf": 1, 
                "typeName": null, 
                "permissionText": null, 
                "menuBeans": null
            }
        ]
    }
]

좋은 웹페이지 즐겨찾기