<div class="accordion" fillSpace="sideBar">
<c:if test="${!empty list}">
<c:forEach var="element" items="${list}">
<div class="accordionHeader">
<h2><span>Folder</span><bean:write name="element" property="privilegeName"/></h2>
</div>
<div class="accordionContent">
<c:if test="${!empty element.rsysAccPrivilegeVOList}">
<ul class="tree treeFolder">
<c:set var="voLevel" value="${element.rsysAccPrivilegeVOList[0].level }"/>
<c:forEach var="subTree" items="${element.rsysAccPrivilegeVOList}">
<c:set var="levelDif" value="${subTree.level - voLevel}"/>
<c:if test="${levelDif eq 0}">
<c:if test="${index ne 0}">
</li>
</c:if>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:if test="${levelDif > 0}">
<ul>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:if test="${levelDif < 0}">
<c:forEach begin="1" end="${-levelDif}" step="1">
<c:out value="</li></ul>" escapeXml="false"/>
</c:forEach>
</li>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:set var="voLevel" value="${subTree.level}"/>
</c:forEach>
</ul>
</c:if>
</div>
</c:forEach>
</c:if>
</div>
----------------------------
private String getSubTree(List<RsysAccPrivilegeVO> privilegeList){
StringBuffer sbTreeStr = new StringBuffer();
if(privilegeList!= null && privilegeList.size() > 0){
for (int i = 0; i < privilegeList.size(); i++) {
RsysAccPrivilegeVO vo = privilegeList.get(i);
sbTreeStr.append("<div class=\"accordionHeader\">");
sbTreeStr.append("<h2><span>Folder</span>"+vo.getPrivilegeName()+"</h2>");
sbTreeStr.append("</div>");
sbTreeStr.append("<div class=\"accordionContent\">");
List<RsysAccPrivilegeVO> subTree = vo.getRsysAccPrivilegeVOList();
if(subTree!= null && subTree.size() > 0){
sbTreeStr.append("<ul class=\"tree treeFolder\">");
Long voLevel = subTree.get(0).getLevel(); //默认级别
for(int j = 0;j < subTree.size(); j++){
RsysAccPrivilegeVO subVO = subTree.get(j);
Long levelDif = subVO.getLevel() - voLevel;
if(levelDif == 0){
if(j != 0){
sbTreeStr.append("</li>");
}
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
if(levelDif > 0){
sbTreeStr.append("<ul>");
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
if(levelDif < 0){
for (Long k = levelDif; k < 0; k++) {
sbTreeStr.append("</li>");
sbTreeStr.append("</ul>");
}
sbTreeStr.append("</li>");
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
voLevel = subVO.getLevel();
}
}
sbTreeStr.append("</ul>");
sbTreeStr.append("</div>");
}
}
return sbTreeStr.toString();
}
<c:if test="${!empty list}">
<c:forEach var="element" items="${list}">
<div class="accordionHeader">
<h2><span>Folder</span><bean:write name="element" property="privilegeName"/></h2>
</div>
<div class="accordionContent">
<c:if test="${!empty element.rsysAccPrivilegeVOList}">
<ul class="tree treeFolder">
<c:set var="voLevel" value="${element.rsysAccPrivilegeVOList[0].level }"/>
<c:forEach var="subTree" items="${element.rsysAccPrivilegeVOList}">
<c:set var="levelDif" value="${subTree.level - voLevel}"/>
<c:if test="${levelDif eq 0}">
<c:if test="${index ne 0}">
</li>
</c:if>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:if test="${levelDif > 0}">
<ul>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:if test="${levelDif < 0}">
<c:forEach begin="1" end="${-levelDif}" step="1">
<c:out value="</li></ul>" escapeXml="false"/>
</c:forEach>
</li>
<li><a <c:if test="${subTree.url ne null}">href="${subTree.url }" target="navTab"</c:if>>${subTree.privilegeName}</a>
</c:if>
<c:set var="voLevel" value="${subTree.level}"/>
</c:forEach>
</ul>
</c:if>
</div>
</c:forEach>
</c:if>
</div>
----------------------------
private String getSubTree(List<RsysAccPrivilegeVO> privilegeList){
StringBuffer sbTreeStr = new StringBuffer();
if(privilegeList!= null && privilegeList.size() > 0){
for (int i = 0; i < privilegeList.size(); i++) {
RsysAccPrivilegeVO vo = privilegeList.get(i);
sbTreeStr.append("<div class=\"accordionHeader\">");
sbTreeStr.append("<h2><span>Folder</span>"+vo.getPrivilegeName()+"</h2>");
sbTreeStr.append("</div>");
sbTreeStr.append("<div class=\"accordionContent\">");
List<RsysAccPrivilegeVO> subTree = vo.getRsysAccPrivilegeVOList();
if(subTree!= null && subTree.size() > 0){
sbTreeStr.append("<ul class=\"tree treeFolder\">");
Long voLevel = subTree.get(0).getLevel(); //默认级别
for(int j = 0;j < subTree.size(); j++){
RsysAccPrivilegeVO subVO = subTree.get(j);
Long levelDif = subVO.getLevel() - voLevel;
if(levelDif == 0){
if(j != 0){
sbTreeStr.append("</li>");
}
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
if(levelDif > 0){
sbTreeStr.append("<ul>");
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
if(levelDif < 0){
for (Long k = levelDif; k < 0; k++) {
sbTreeStr.append("</li>");
sbTreeStr.append("</ul>");
}
sbTreeStr.append("</li>");
if(StringUtil.isEmpty(subVO.getUrl())){
sbTreeStr.append("<li><a>"+subVO.getPrivilegeName()+"</a>");
}else{
sbTreeStr.append("<li><a href="+subVO.getUrl()+" target=\"navTab\">"+subVO.getPrivilegeName()+"</a>");
}
}
voLevel = subVO.getLevel();
}
}
sbTreeStr.append("</ul>");
sbTreeStr.append("</div>");
}
}
return sbTreeStr.toString();
}