struts-menu(list-menu样式和treemenu样式)

struts-menu(list-menu样式和treemenu样式)

在上篇文章的基础上。新建一个jsp文件listmenu.jsp内容如下

<% @ include file = " /common/header.jsp " %>

< script type = " text/javascript "  src = " ./scripts/coolmenus3.js " ></ script >
< script type = " text/javascript "  src = " ./scripts/coolmenu-config.js " ></ script >

< menu:useMenuDisplayer name = " CoolMenu "  bundle = " org.apache.struts.action.MESSAGE " >
    
< menu:displayMenu name = " ToDoListMenuFile " />
    
< menu:displayMenu name = " ToDoListMenuEdit " />
    
< menu:displayMenu name = " CaseDetailMenuCase " />
</ menu:useMenuDisplayer >

<% @ include file = " /common/footer.jsp " %>

然后在menu-conmfig.xml的menus之间加入如下内容

<!--   ====================    To Do List Menus    ===========================   -->
    
< Menu  name = " ToDoListMenuFile "   title = " FILE "   description = " test "  width = " 50 " >
       
< Item   name = " TDLnew "    title = " NEW " >
           
< Item   name = " TDLnewcase "    title = " CASE "     image = " images/case-new.png "
                   location
= " NewCase.jsp " />
           
< Item   name = " TDLnewitem "     title = " ITEM "    image = " images/item-new.png "
                   location
= " index.jsp " />
           
< Item   name = " TDLnewparty "    title = " PARTY "   image = " images/party-new.png "
                   location
= " index.jsp " />
       
</ Item >
       
< Item   name = " TDLopen "    title = " OPEN " >
           
< Item   name = " TDLopencase "     title = " CASE "    image = " images/case-open.png "
                    location
= " index.jsp " />
           
< Item   name = " TDLopenitem "    title = " ITEM "     image = " images/item-open.png "
                    location
= " index.jsp " />
           
< Item   name = " TDLopenparty "   title = " PARTY "    image = " images/party-open.png "
                    location
= " index.jsp " />
       
</ Item >
       
< Item    name = " TDLexit "   title = " EXIT "
                image
= " images/exit.png "    location = " index.jsp " />
    
</ Menu >

    
< Menu  name = " ToDoListMenuEdit "   title = " EDIT " >
         
< Item  name = " TDLselect "  title = " SELECT_ALL "        image = " images/select-all.png "
                    location
= " index.jsp "  width = " 100 "   />
         
< Item  name = " TDLprefs "   title = " USER_PREFERENCES "  image = " images/prefs.png "
                    location
= " index.jsp "  width = " 150 "   />
    
</ Menu >

    
<!--  CASE  -->
    
< Menu  name = " CaseDetailMenuCase "    title = " CASE " >
         
< Item  name = " CDadd "     title = " ADD " >
              
< Item   name = " CDaddparty "     title = " PARTY "       image = " images/party-add.png " />
              
< Item   name = " CDadditem "      title = " ITEM "        image = " images/item-add.png " />
              
< Item   name = " CDaddcomments "  title = " COMMENTS "    image = " images/comments.png " />
              
< Item   name = " CDadddoc "       title = " DOCUMENTS "   image = " images/documents.png " />
              
< Item   name = " CDaddposition "  title = " POSITION "    image = " images/positions.png " />
         
</ Item >
         
< Item  name = " CDopen "    title = " OPEN " >
              
< Item   name = " CDopenparty "     title = " PARTY "       image = " images/party-open.png " />
              
< Item   name = " CDopenitem "      title = " ITEM "        image = " images/item-open.png " />
              
< Item   name = " CDopencomments "  title = " COMMENTS "    image = " images/comments.png " />
              
< Item   name = " CDopendoc "       title = " DOCUMENTS "   image = " images/documents.png " />
              
< Item   name = " CDopenposition "  title = " POSITION "    image = " images/positions.png " />
              
< Item   name = " CDopenhistory "   title = " HISTORY "     image = " images/history.png " />
         
</ Item >
         
< Item  name = " CDassign "     title = " ASSIGN "            image = " images/assign.png " />
         
< Item  name = " CDactivate "   title = " ACTIVATE "          image = " images/activate.png " />
         
< Item  name = " CDpublish "    title = " PUBLISH "           image = " images/case-pub.png " />
         
< Item  name = " CDescalate "   title = " ESCALATE "          image = " images/escalate.png " />
         
< Item  name = " CDdecide "     title = " DECIDE "            image = " images/decide.png " />
         
< Item  name = " CDgenlicen "   title = " GENERATE_LICENSE "  image = " images/genlicense.png " />
    
</ Menu >

在主页上点击coolmenu example就进入了listmenu的画面。如下
struts-menu(list-menu样式和treemenu样式)_第1张图片

继续复用listmenu的配置文件,只新建一个jsp文件velocity-xtree.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 > XTree (with Velocity) Example </ title >

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

    
< link rel = " stylesheet "  type = " text/css "  media = " screen "
        href
= " styles/global.css "   />
    
< link rel = " stylesheet "  type = " text/css "  media = " screen "
        href
= " styles/xtree.css "   />
    
< style type = " text/css " >
    div.container 
{
        position: absolute;
        width: 200px;
        top: 0px;
        left: 0px;
        height: 
100%;
        padding: 5px;
        overflow: auto;
    }

    
</ style >
    
< script type = " text/javascript "  src = " scripts/xtree.js " ></ script >

</ head >
< body >

< div  class = " container " >
< script type = " text/javascript " >
< menu:useMenuDisplayer name = " Velocity "  config = " /templates/xtree.html "
  bundle
= " org.apache.struts.action.MESSAGE " >
if  (document.getElementById)  {
    
<menu:displayMenu name="ToDoListMenuFile"/>
    
<menu:displayMenu name="ToDoListMenuEdit"/>
    
<menu:displayMenu name="CaseDetailMenuCase"/>
}
  else   {
  var msg 
= "Your browser does not support document.getElementById().\n";
    msg 
+= "You must use a modern browser for this menu.";
  alert(msg);
}

</ menu:useMenuDisplayer >
</ script >
</ div >

< div id = " content "  style = " margin-left: 150px " >
The homepage 
for   this  menu is  < a href = " http://webfx.eae.net/dhtml/xtree/index.html " > http: // webfx.eae.net/dhtml/xtree/index.html</a>.
Please refer to  this  site and it ' s support system for any menu-specific questions. 
</ div >

< div id = " pageSource " >
< strong > Files used in  this  page: </ strong >< br  />
-   < a href = " templates/xtree.html.src " > templates / xtree.html </ a >
    
< a href = " templates/xtree.html "  
        title
= " Right click and 'Save Target As' to download " >
        
< img src = " images/download.gif "  
        
class = " download "  alt = " download " /></ a >< br  />
-   < a href = " styles/xtree.css.src " > styles / xtree.css </ a >
    
< a href = " styles/xtree.css "  
        title
= " Right click and 'Save Target As' to download " >
        
< img src = " images/download.gif "  
        
class = " download "  alt = " download " /></ a >< br  />
-   < a href = " scripts/xtree.js.src " > scripts / xtree.js </ a >
    
< a href = " scripts/xtree.js "  
        title
= " Right click and 'Save Target As' to download " >
        
< img src = " images/download.gif "  
        
class = " download "  alt = " download " /></ a >< br  />
-   < a href = " images/foldericon.png " > images / foldericon.png </ a >< br  />
-   < a href = " images/openfoldericon.png " > images / openfoldericon.png </ a >< br  />
-   < a href = " images/foldericon.png " > images / foldericon.png </ a >< br  />
-   < a href = " images/file.png " > images / file.png </ a >< br  />
-   < a href = " images/I.png " > images / I.png </ a >< br  />
-   < a href = " images/L.png " > images / L.png </ a >< br  />
-   < a href = " images/Lminus.png " > images / Lminus.png </ a >< br  />
-   < a href = " images/Lplus.png " > images / Lplus.png </ a >< br  />
-   < a href = " images/T.png " > images / T.png </ a >< br  />
-   < a href = " images/Tminus.png " > images / Tminus.png </ a >< br  />
-   < a href = " images/Tplus.png " > images / Tplus.png </ a >< br  />
-   < a href = " images/blank.png " > images / blank.png </ a >< br  />
</ div >

< div id = " source " >
    
< a href = " <%=request.getRequestURI()%>.src " > View JSP Source </ a >< br  />
    
< a href = " <%=request.getContextPath()%>/index.jsp " > Back to Index </ a >
</ div >


</ body >
</ html >


部署,访问得到结果如下
struts-menu(list-menu样式和treemenu样式)_第2张图片 
以上三篇文章的source下载
http://www.blogjava.net/Files/dreamstone/mymenu.rar
下载后自己增加lib文件

你可能感兴趣的:(struts-menu(list-menu样式和treemenu样式))