springboot shiro标签 springboot 在ftl页面上使用shiro标签的实例代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

springboot shiro标签 springboot 在ftl页面上使用shiro标签的实例代码

微笑彡三色   2021-03-28 我要评论
想了解springboot 在ftl页面上使用shiro标签的实例代码的相关内容吗,微笑彡三色在本文为您仔细讲解springboot shiro标签的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:springboot,shiro标签,下面大家一起来学习吧。

1.首先第一步导入依赖

<dependency> 
  <groupId>com.github.theborakompanioni</groupId> 
  <artifactId>thymeleaf-extras-shiro</artifactId> 
  <version>1.2.1</version>  
</dependency> 

2.在配置shiro权限的方法内加入

@Bean 
  public ShiroDialect shiroDialect() { 
    return new ShiroDialect(); 
  } 

3.ftl页面中引入命名空间

<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> 

4.ftl页面中使用标签   

<@shiro.hasRole name="merchants"> 
            <div> 
              我有这个角色哦! 
            </div> 
</@shiro.hasRole>  

总结

以上所述是小编给大家介绍的springboot 在ftl页面上使用shiro标签的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们