springboot 中在ftl頁面上使用shiro標籤

1.首先第一步導入依賴

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

2.ftl頁面中引入命名空間

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

3.ftl頁面中使用標籤    

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章