在struts-config.xml中定义struts-menu插件,定义语句如下:
<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
</plug-in>
在menu-config.xml中定义菜单项,定义遇句如下:
<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>
以上代码定义了一个菜单名为ToDoListMenuFile,标题为FILE的菜单,属于一个多级级联菜单.
在JSP页面调用的代码如下所示:
<menu:useMenuDisplayer name="DropDown" bundle="org.apache.struts.action.MESSAGE">
<table cellpadding=0 cellspacing=0>
<tr>
<td>
<menu:displayMenu name="ToDoListMenuFile" target="filewindow"/>
</td>
</tr>
<tr>
<td>
<menu:displayMenu name="ToDoListMenuEdit"/>
</td>
</tr>
<tr>
<td>
<menu:displayMenu name="CaseDetailMenuCase"/>
</td>
</tr>
</table>
</menu:useMenuDisplayer>
<plug-in className="net.sf.navigator.menu.MenuPlugIn">
<set-property property="menuConfig" value="/WEB-INF/menu-config.xml"/>
</plug-in>
在menu-config.xml中定义菜单项,定义遇句如下:
<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>
以上代码定义了一个菜单名为ToDoListMenuFile,标题为FILE的菜单,属于一个多级级联菜单.
在JSP页面调用的代码如下所示:
<menu:useMenuDisplayer name="DropDown" bundle="org.apache.struts.action.MESSAGE">
<table cellpadding=0 cellspacing=0>
<tr>
<td>
<menu:displayMenu name="ToDoListMenuFile" target="filewindow"/>
</td>
</tr>
<tr>
<td>
<menu:displayMenu name="ToDoListMenuEdit"/>
</td>
</tr>
<tr>
<td>
<menu:displayMenu name="CaseDetailMenuCase"/>
</td>
</tr>
</table>
</menu:useMenuDisplayer>
struts-menu.war的下载地址是:http://sourceforge.net/project/showfiles.php?group_id=48726