1.首先第一步导入依赖
? 1 2 3 4 5 <dependency> <groupid>com.github.theborakompanioni</groupid> <artifactid>thymeleaf-extras-shiro</artifactid> <version>1.2.1</version> </dependency>2.在配置shiro权限的方法内加入
? 1 2 3 4 @bean public shirodialect shirodialect() { return new shirodialect(); }3.ftl页面中引入命名空间
? 1 <html lang="zh_cn" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">4.ftl页面中使用标签
? 1 2 3 4 5 <@shiro.hasrole name="merchants"> <div> 我有这个角色哦! </div> </@shiro.hasrole>总结
以上所述是小编给大家介绍的springboot 在ftl页面上使用shiro标签的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!
原文链接:https://blog.csdn.net/u014514528/article/details/80255375