1<!-- 生成树形菜单对象,并存入session -->
2 <c:set var="treeName" value="tree.model"/>
3 <c:if test="${empty sessionScope[treeName]}">
4<!-- 生成树对象 -->
5<jsp:useBean id="tree" class="com.jenkov.prizetags.tree.impl.Tree" scope="page"/>
6<!-- 生成根结点对象 -->
7<jsp:useBean id="root" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
8<jsp:setProperty name="root" property="id" value="rootId"/>
9<jsp:setProperty name="root" property="name" value="后台管理操作菜单"/>
10<jsp:setProperty name="root" property="type" value="root"/>
11<!-- 生成文章管理功能集结点对象 -->
12<jsp:useBean id="articleAdmins" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
13<jsp:setProperty name="articleAdmins" property="id" value="articleAdminsId"/>
14<jsp:setProperty name="articleAdmins" property="name" value="文章发布"/>
15<jsp:setProperty name="articleAdmins" property="type" value="functions"/>
16<!-- 生成用户管理功能集结点对象 -->
17<jsp:useBean id="userAdmins" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
18<jsp:setProperty name="userAdmins" property="id" value="userAdminsId"/>
19<jsp:setProperty name="userAdmins" property="name" value="用户管理"/>
20<jsp:setProperty name="userAdmins" property="type" value="functions"/>
21<!-- 生成增加文章功能结点对象 -->
22<jsp:useBean id="addArticle" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
23<jsp:setProperty name="addArticle" property="id" value="addArticleId"/>
24<jsp:setProperty name="addArticle" property="name" value="增加文章"/>
25<jsp:setProperty name="addArticle" property="type" value="function"/>
26<!-- 生成修改与删除文章功能结点对象 -->
27<jsp:useBean id="updateArticle" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
28<jsp:setProperty name="updateArticle" property="id" value="updateArticleId"/>
29<jsp:setProperty name="updateArticle" property="name" value="修改与删除文章"/>
30<jsp:setProperty name="updateArticle" property="type" value="function"/>
31<!-- 生成栏目管理功能结点对象 -->
32<jsp:useBean id="channelAdmin" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
33<jsp:setProperty name="channelAdmin" property="id" value="channelAdminId"/>
34<jsp:setProperty name="channelAdmin" property="name" value="栏目管理"/>
35<jsp:setProperty name="channelAdmin" property="type" value="function"/>
36<!-- 生成用户管理功能结点对象 -->
37<c:if test="${sessionScope.adminUserRole==2}">
38<jsp:useBean id="userAdmin" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
39<jsp:setProperty name="userAdmin" property="id" value="userAdminId"/>
40<jsp:setProperty name="userAdmin" property="name" value="用户管理"/>
41<jsp:setProperty name="userAdmin" property="type" value="function"/>
42<%userAdmin.setParent(userAdmins);%>
43</c:if>
44<!-- 修改当前用户密码功能结点对象 -->
45<jsp:useBean id="userPowerAdmin" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
46<jsp:setProperty name="userPowerAdmin" property="id" value="userPowerAdminId"/>
47<jsp:setProperty name="userPowerAdmin" property="name" value="修改当前用户密码"/>
48<jsp:setProperty name="userPowerAdmin" property="type" value="function"/>
49<!-- 生成退出系统功能结点对象 -->
50<jsp:useBean id="exitSys" class="com.jenkov.prizetags.tree.impl.TreeNode"/>
51<jsp:setProperty name="exitSys" property="id" value="exitSysId"/>
52<jsp:setProperty name="exitSys" property="name" value="退出系统"/>
53<jsp:setProperty name="exitSys" property="type" value="function"/>
54<!-- 设置结点之前的父子关系 -->
55<%addArticle.setParent(articleAdmins);
56 updateArticle.setParent(articleAdmins);
57 userPowerAdmin.setParent(userAdmins);
58 articleAdmins.setParent(root);
59 channelAdmin.setParent(root);
60 userAdmins.setParent(root);
61 exitSys.setParent(root);
62 tree.setRoot(root); %>
63<!-- 将树对象存入session -->
64<c:set var="tree.model" value="${tree}" scope="session"/>
65 </c:if>