Express Learning Struts Menu

系统 2274 0

Express Learning Struts Menu

The firts go struts menu official site dowload struts-menu-X.X.X.war file,把文件放到Tomecate 目录webapps 目录下,然后启动tomcate,访问http://localhost: 9090 /struts-menu-X.X.X,you will shoult effect。

The following introduction express create struts - menu item.

1.拷贝相应的类库到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

2.拷贝struts-menu工程中的common     image    scripts    styles   templates等目录到新的web工程 
拷贝taglib.jsp到webroot下

三.新建一个jsp文件index.jsp内容如下

<% @ 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内容如下
<? 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内容如下
<? 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 >

 

部署工程,访问,出现如下效果。

Express Learning Struts Menu
这是最普通的效果。
试着往menu-config.xml中加入item对应的menu也会跟着增加。

 

参考

http://code.google.com/p/strutsmenu/source/

 

 

 

 

 

Express Learning Struts Menu


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论