Chinaunix首页 | 论坛 | 博客
  • 博客访问: 341181
  • 博文数量: 329
  • 博客积分: 2633
  • 博客等级: 少校
  • 技术积分: 3633
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-22 15:43
文章分类

全部博文(329)

文章存档

2013年(244)

2012年(46)

2011年(39)

我的朋友

分类: 系统运维

2012-03-02 20:23:37

界面:
 
jsp代码:
  1. <%@ page language="java" pageEncoding="gb2312"%>
  2. <%@ page import="java.util.*,com.hiernate.persistence.Menu"%>

  3. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  4. <%
  5.          List listfather = (List)session.getAttribute("menulist"); //获得主菜单集合

  6.              if(listfather.isEmpty()){ //判断主菜单是否为空

  7. %>
  8. <tr>
  9.             <td align="center">暂无功能分类信息!>
  10.         </tr>
  11.          <%}
  12.          else{ //如果主菜单不为空,进行以下操作

  13.              int m=1;
  14.              for(int j=0;j<listfather.size();j++){
  15.              Menu menufather = (Menu)listfather.get(j);
  16.              List listsun = (List)session.getAttribute("menuNameid"+j+"");//获得子菜单集合

  17.             %>
  18.         <tr>
  19.             <td height="27" valign="top">
  20.                 <%
  21.                  if(listsun.isEmpty()){
  22.                      for(int i=1;i<listsun.size();i++){
  23.                 %>
  24.                 &nbsp;
  25.                 <img src="Images/jian_null.gif" width="38" height="16" border="0">
  26.                 <%=menufather.getMenuName()%>
  27.                 <%}}
  28.                 else{%>
  29.                 &nbsp;
  30.                 <a href="Javascript:ShowTR(img<%=m%>,OpenRep<%=m%>)"><img
  31.                         src="Images/jia.gif" border="0" alt="展开" id="img<%=m%>">
  32.                 </a>
  33.                 <a href="Javascript:ShowTR(img<%=m%>,OpenRep<%=m%>)">
  34.                     <%=menufather.getMenuName()%>
  35.                 </a>
  36.                 <%}%>
  37.          </td>
  38.                 <%
  39.                  if(listsun.size()>0){ // 判断子菜单集合的长度是否大于0

  40.                 %>
  41.   <tr id="OpenRep<%=m%>" style="display:none;">
  42.             <td colspan="6">
  43.                 <% for(int k=0;k<listsun.size();k++){
  44.                  Menu menusun = (Menu)listsun.get(k); //利用循环将子菜单显示在页面上

  45.                  %>
  46.                 <table width="94%" border="0" cellspacing="0" cellpadding="0">
  47.                     <tr>
  48.                         <td height="25" align="center">
  49.                             <table width="90%" border="0" cellspacing="0" cellpadding="0">
  50.                                 <tr>
  51.                                     <td width="7%" align="left">
  52.                                         &nbsp;&nbsp;&nbsp;
  53.                                         <img src="Images/folder.gif" width="16" height="16" border="0">
  54.                                     </td>
  55.                                     <td width="93%" align="left">
  56.                                         &nbsp;
  57.                                         <a href="<%=menusun.getLinkurl()%>" target="mainFrame">
  58.                                         <%=menusun.getMenuName()%>
  59.                                         </a>
  60.                                     </td>
  61.                                 </tr>
  62.                             </table>
  63.                         </td>
  64.                     </tr>
  65.                 </table>
  66.                 <%m=m+1;}%>
  67.             </td>
  68.             <%}%>
  69.         </tr>
  70.         <%}}%>
  71.         </table>
  72.  <script language="javascript">
  73.   ShowTR(img1,OpenRep1) //设置第1个结点为展开状态
  74.   function ShowTR(objImg,objTr) //应用javascript完成页面显示效果
  75.     {
  76.     if(objTr.style.display == "block")
  77.     {
  78.         objTr.style.display = "none";
  79.         objImg.src = "Images/jia.gif";
  80.         objImg.alt = "展开";        
  81.     }
  82.     else
  83.     {
  84.         objTr.style.display = "block";
  85.         objImg.src = "Images/jian.gif";
  86.         objImg.alt = "折叠";        
  87.     }
  88.     }
  89. </script>
 
 
 
阅读(10116) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~