jfinal shiro plugin freemarker tags,查看其他插件-> Maven
maven 引用 ${jfinal-shiro-freemarker.version}替换为相应的版本如:0.2
<dependency>
<groupId>cn.dreampie</groupId>
<artifactId>jfinal-shiro-freemarker</artifactId>
<version>${jfinal-shiro-freemarker.version}</version>
</dependency>
在freemarker中使用
FreeMarkerRender.getConfiguration().setSharedVariable("shiro", new ShiroTags());
已经登陆判断
<@shiro.authenticated>
<li><a href="https://github.com/Dreampie/jfinal-shiro-freemarker/blob/master/user/center"><@shiro.principal name="full_name"/></a></li>
|
<li><a href="https://github.com/Dreampie/jfinal-shiro-freemarker/blob/master/signout">退出</a></li>
</@shiro.authenticated>
没有登陆判断
<@shiro.notAuthenticated>
<li><a href="https://github.com/Dreampie/jfinal-shiro-freemarker/blob/master/">登陆</a></li>
</@shiro.notAuthenticated>
显示登陆异常
<@shiro.isLoginFailure name="shiroLoginFailure">
<@shiro.loginException name="shiroLoginFailure"/>
</@shiro.isLoginFailure>
判断角色
<@shiro.hasRole name="ROLE_ADMIN">
我是admin
</@shiro.hasRole>
判断权限
<@shiro.hasPermission name="P_ORDER_CONTROL">
<li><a href="https://github.com/Dreampie/jfinal-shiro-freemarker/blob/master/order/branch" class="<#if activebar=='branch'>nav-active</#if>">全部订单</a></li>
</@shiro.hasPermission>