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.