springboot 在ftl页面上使用shiro标签的实例代码
2018-05-09 16:33
901 查看
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标签的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:
相关文章推荐
- spring boot使用thymeleaf跳转页面实例代码
- 本文主要介绍使用SpringBoot与shiro实现基于数据库的细粒度动态权限管理系统实例。
- SpringBoot创建JSP登录页面功能实例代码
- springboot 继承shiro 使用redis缓存 @Value 标签无效 无法获取值
- Spring Boot Shiro 权限信息缓存处理,记住我,thymleaf使用shiro标签
- Spring Boot定时任务的使用实例代码
- Spring Boot 搭建应用实现登陆实例,页面使用bootstrap
- SpringBoot使用Thymeleaf3.0自定义标签,简单实例。快速学习!
- Spring Boot Shiro 权限信息缓存处理,记住我,thymleaf使用shiro标签
- springboot+shiro实现登录系数限定,thymeleaf中使用shiro标签
- spring mvc + shiro +thymeleaf 扩展使用shiro tags页面标签
- spring boot 使用velocity、freeMarker模板创建html页面返回给前端
- 详解Spring Boot 使用Java代码创建Bean并注册到Spring中
- Apache Shiro 整合Spring 进行权限验证 以及在Freemarker中使用shiro标签
- SpringBoot配置使用jsp页面技术
- Spring Boot 使用Java代码创建Bean并注册到Spring中
- 使用代码向一个普通的类注入Spring的实例
- 41. Spring Boot 使用Java代码创建Bean并注册到Spring中【从零开始学Spring Boot】
- maven工程使用spring-boot-devtools进行热部署,更改代码避免重启web容器
- 使用 Masonry 进行页面布局时的实例代码