Use Struts-menu _ to implement dynamic menus in detail

Source: Internet
Author: User
Tags tld

Preparations:

 

Download the struts menu and decompress the sample package (some libraries in Struts-menu are not provided, but they are included in the example)Procedure

1. Create a tomcat Project

2. Add webproject support


3. Added struts support.

4. Added support for jstl.


5, copy necessary jar library files to dbmenuweb-inflib log4j-1.2.8.jar velocity-1.4.jar velocity-tools-view-1.0.jar struts-menu-2.3.jar

6, create the menu-config.xml file in the dbmenuweb-INF directory. The content is as follows:

<? 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"/>
</Displayers>

</Menuconfig>

 

 

 

<Plug-in classname = "net. SF. Navigator. Menu. menuplugin">
<Set-Property = "menuconfig"
Value = "/WEB-INF/menu-config.xml"/>
</Plug-in>

8. Copy necessary files.

Images/*. * scripts/menuexpandable. js xtree. js styles/menuexpandable.css global.css xtree.css templates/xtree.html dbMenuWEB-INFclassesglobalMacros.vm ???)

10. Copy the TLD file to dbmenuweb-INF.

Struts-menu.tld
Struts-menu-el.tld

11. I don't know why. I need to modify version = 2.3 in the web. xml file.

<Web-app version = "2.3">

Add in Web. xml

<Context-param>
<Param-Name> javax. servlet. jsp. jstl. FMT. localizationcontext </param-Name>
<Param-value> trackerres </param-value>
</Context-param>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7. Modify the struts-config.xml file and add the following parts

11. Create a database

 

Copy the following code to create a database:

<SQL: Update>
Create Table menu_item (
Id bigint not null,
Parent_name varchar (30 ),
Name varchar (30 ),
Title varchar (30 ),
Description varchar (50 ),
Location varchar (255 ),
Target varchar (10 ),
Onclick varchar (100 ),
Onmouseover varchar (100 ),
Onmouseout varchar (100 ),
Image varchar (50 ),
Altimage varchar (30 ),
Tooltip varchar (100 ),
Roles varchar (100 ),
Page varchar (255 ),
Width varchar (5 ),
Height varchar (5 ),
Forward varchar (50 ),
Action varchar (50 ),
Primary Key (ID)
)
</SQL: Update>

12. Enter the database

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.