无论是在使用shiro还是security都需要导入相关的依赖,就是thymeleaf整合这两个包的相关依赖和命名空间
xmlns:th="http://www.thymeleaf.org xmlns:sec=“http://www.thymeleaf.org/thymeleaf-extras-springsecurity5” xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro"shiro在前段显示用户名
依赖
com.github.theborakompanioni thymeleaf-extras-shiro 2.1.0
首先要在认证的时候把user对象传递出去。
然后在前前端我们可以通过如下的代码来显示出我们想要的数据
其中property=“name” 中的name,对应的就是实类中的属性,如果不加property那么前端将显示这个用户的全部信息
security在前端显示用户名
依赖
org.thymeleaf.extras thymeleaf-extras-springsecurity5
通过下边的代码就可以了



