使用jsp为模板的时候 shiro的引用是这样的:<%@ taglib uri="http://shiro.apache.org/tags"
prefix="shiro"%>
现在用thymeleaf这样引用就没用了,要这样引用:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
另外,需要导包并且简单配置一下
<!-- 兼容于thymeleaf的shiro --> <dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId> <version>2.0.0</version>
</dependency>
另外要注意
由于这个thymeleaf-extras-shiro包2.0.0以下的版本会导致找不到AbstractTextChildModifierAttrPr的错误,所以这个包的版本由1.2.1改成2.0.0
好了 基本上整合shiro标签的步骤就是这些了。
热门工具 换一换