JSP + XML menu with permission control similar to QQ (you only need to configure xml to generate a menu)

Source: Internet
Author: User

To put it bluntly, we will introduce the main functions of the code I wrote: This menu program can be used only by configuring XML, and one or more permissions can be set for each menu item during configuration, easy to use. You can download it as soon as possible. I uploaded it to my resources.

Code Overview:

XML file:

<? Xml version = "1.0" encoding = "GB2312"?>
<MenuConfig>
<Displayers>
<Displayer name = "ListMenu" type = "wp.com"/>
</Displayers>
<! -- Roles indicates user permissions. Multiple permissions are separated by commas. -->
<Menus>
<Menu name = "yonghuguanli" title = "user management">
<Item name = "zjyh" target = "main" title = "Add user 1" location = "aa" roles = "mm"/>
<Item name = "scyh" target = "main" title = "delete user 2" location = "bb" roles = "xx, dd"/>
<Item name = "zjyh" target = "main" title = "Add user 3" location = "aa" roles = "xx"/>
<Item name = "scyh" target = "main" title = "delete user 4" location = "bb" roles = "xx, cc"/>
</Menu>
<Menu name = "shebeiguanli" title = "device management">
<Item name = "zjsb" target = "main" title = "Add a device" location = "#" roles = "cc"/>
<Item name = "scsb" target = "main" title = "delete a device" location = "#" roles = "xx"/>

</Menu>

....................

..........................

For example, if user A has the dd and cc permissions, only two corresponding menus are displayed.

If the user does not have the permission to include sub-menus, the total menu is not displayed.

Call method:

......

CreatMenu cm = new creatMenu ();
String source = cm. readDom ("dd, cc"); // user permissions

.......

 

Menu Image style:

</

Related Article

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.