使用shiro框架的标签来根据权限显示按钮

第一步:在jsp页面中引入shiro的标签库

<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> 

第二步:使用shiro的标签控制页面元素展示


<shiro:hasPermission name="sys:user:add">
	{
		id : 'button-add',
		text : '添加',
		iconCls : 'icon-cancel',
		handler : doadd
	},
	</shiro:hasPermission>

若没有add这权限,被shiro包括起来的内容不会显示。

这个标签只是起一个显示作用,真正的拦截还是在shiro注解配置中。故即使使用url访问action并进行删除也是可以拦截下来的。

猜你喜欢

转载自blog.csdn.net/weixin_39654286/article/details/84945936
今日推荐