freemarker中使用shiro标签

地址:https://github.com/jagregory/shiro-freemarker-tags
下载该jar包 或者源代码文件复制到自己工程的lib下或者package中 


如果使用spring MVC,请看http://www.woxplife.com/articles/473.html 
如果单独使用Freemarker 比如使用模板生成静态页, 在相关的类中加入如下代码: 

Configuration cfg = new Configuration(); 
cfg.setDefaultEncoding(“UTF-8”); 
cfg.setSharedVariable("shiro", new ShiroTags()); 

然后在ftl页面中使用tag: 

<@shiro.hasRole name=”admin”>Hello admin!</@shiro.hasRole> 
原文地址:https://www.cnblogs.com/eastson/p/3951143.html