posts - 14,  comments - 37,  trackbacks - 0
          struts-menu可以做成各種各樣的menu,這里演示一些簡(jiǎn)單的用法。方便入門(mén)
          一、在sourceforge上下載最新版本的strutsmenu
          http://struts-menu.sourceforge.net/
          解壓縮zip文件得到struts-menu.war,解壓縮它,要用到里邊的js文件,imgage文件和css文件等
          這個(gè)本來(lái)是struts-menu的演示工程,本文簡(jiǎn)化了里邊的東西,選擇里邊比較有代表性的幾個(gè)拿出。
          二、新建一個(gè)web工程。
          拷貝相應(yīng)的類(lèi)庫(kù)到lib目錄下。
          velocity-tools-view-1.0.jar
          velocity-1.4.jar
          struts-menu-2.4.2.jar
          struts-1.2.9.jar
          standard-1.0.6.jar
          log4j-1.2.8.jar
          jstl-1.0.6.jar
          commons-logging-1.0.4.jar
          等,基本就是struts-menu工程中的jar文件
          拷貝struts-menu工程中的common     image    scripts    styles   templates等目錄到新的web工程 
          拷貝taglib.jsp到webroot下
          三.新建一個(gè)jsp文件index.jsp內(nèi)容如下
          <%@ include file="/taglibs.jsp"%>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
              
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

          <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
          <head>
              
          <title>Struts Menu Example Application</title>

              
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

              
          <script type="text/javascript" src="scripts/nicetabs.js"></script>
              
              
          <link rel="stylesheet" type="text/css" media="screen"
                  href
          ="styles/global.css" />
              
          <link rel="stylesheet" type="text/css" media="screen"
                href
          ="styles/nicetabs.css" />

          </head>
          <body id="index">
          <div id="content" style="width: 100%">
              
          <h2>Struts Menu Examples</h2>
              
          <p>
                  Click on the menu links below to see the different types of menus
                  supported by Struts Menu.
              
          </p>

              
          <menu:useMenuDisplayer name="Velocity" config="/templates/index.html">
                  
          <ul class="glassList">
                  
          <menu:displayMenu name="indexMenu"/>
                  
          </ul>
              
          </menu:useMenuDisplayer>

          </div>

          <div id="footer">
            
          <a href="http://struts-menu.sf.net">Struts Menu Homepage</a>
          </div>
          </body>
          </html>
          WEB-INF下建立struts-config.xml內(nèi)容如下
          <?xml version="1.0" encoding="ISO-8859-1" ?>

          <!DOCTYPE struts-config PUBLIC
                    
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
                    
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
          <struts-config>
            
          <!-- ========== Plug Ins Configuration ================================== -->
            
          <plug-in className="net.sf.navigator.menu.MenuPlugIn">
              
          <set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
            
          </plug-in>
          </struts-config>
          建立menu-config.xml內(nèi)容如下
          <?xml version="1.0" encoding="UTF-8" ?>

          <MenuConfig>

            
          <Displayers>
              
          <Displayer   name="DropDown"
                           type
          ="net.sf.navigator.displayer.DropDownMenuDisplayer"/>
              
          <Displayer   name="Simple"
                           type
          ="net.sf.navigator.displayer.SimpleMenuDisplayer"/>
              
          <Displayer   name="CoolMenu"
                           type
          ="net.sf.navigator.displayer.CoolMenuDisplayer"/>
              
          <Displayer   name="CoolMenu4"
                           type
          ="net.sf.navigator.displayer.CoolMenuDisplayer4"/>
              
          <Displayer   name="MenuForm"
                           type
          ="net.sf.navigator.example.PermissionsFormMenuDisplayer"/>
              
          <Displayer   name="ListMenu"
                           type
          ="net.sf.navigator.displayer.ListMenuDisplayer"/>
              
          <Displayer   name="TabbedMenu"
                           type
          ="net.sf.navigator.displayer.TabbedMenuDisplayer"/>
              
          <Displayer   name="Velocity"
                           type
          ="net.sf.navigator.displayer.VelocityMenuDisplayer"/>
              
          <Displayer   name="XtreeMenu"
                           type
          ="net.sf.navigator.displayer.XtreeMenuDisplayer"/>
              
          <Displayer   name="CSSListMenu"
                           type
          ="net.sf.navigator.displayer.CSSListMenuDisplayer"/>
            
          </Displayers>

            
          <Menus>

              
          <Menu  name="indexMenu"  title="Examples">
                  
          <!-- page attribute indicating a context relative resource.
                       The context path will be prepended to the value. 
          -->        
                  
          <Item  title="tablemeun"
                         toolTip
          ="Shows table menu"
                         page
          ="/tablemenu.jsp"/>
                  
          <Item  name="listmenu"  title="CoolMenu Example"
                         toolTip
          ="Shows menu using CoolMenu"
                         page
          ="/listmenu.jsp"/>
                  
          <Item  title="Velocity XTree Menu"
                         toolTip
          ="Shows Velocity generated XTree"
                         page
          ="/velocity-xtree.jsp"/>
                         
              
          </Menu>

            
          </Menus>

          </MenuConfig>
          部署工程,訪問(wèn),出現(xiàn)如下效果。


          這是最普通的效果。
          試著往menu-config.xml中加入item對(duì)應(yīng)的menu也會(huì)跟著增加。
          下篇文章將繼續(xù)提供一些更漂亮一些的menu
          posted on 2007-07-11 10:14 冰封的愛(ài) 閱讀(212) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): J2EE
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(3)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          相冊(cè)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 梅河口市| 寿宁县| 汉阴县| 天台县| 襄垣县| 城口县| 炉霍县| 开化县| 瑞昌市| 冷水江市| 蓬安县| 曲靖市| 霍城县| 华亭县| 巴林右旗| 榆树市| 游戏| 易门县| 平远县| 郓城县| 如皋市| 卓尼县| 老河口市| 襄城县| 奉新县| 木里| 巫溪县| 长阳| 嘉祥县| 宝坻区| 安溪县| 宣化县| 高邮市| 宜昌市| 页游| 赤城县| 林甸县| 正镶白旗| 芜湖市| 勃利县| 枣强县|