转载于:http://blog.youkuaiyun.com/lifaming15/article/details/44726467
shiro应用,注销掉后让系统跳转到登陆页
查看源码可以看到,shiro注销,默认情况是跳转到网站首页,但有的项目中首页并不是登录页面,所以需要注销后跳转到指定的页面。
1、在shiro的配置文件applicationContext-shiro.xml中增加LogoutFilter并配置注销需要跳转的url,代码:
2、将上述LogoutFilter加入shiro过滤器,可参考如下代码:
查看源码可以看到,shiro注销,默认情况是跳转到网站首页,但有的项目中首页并不是登录页面,所以需要注销后跳转到指定的页面。
1、在shiro的配置文件applicationContext-shiro.xml中增加LogoutFilter并配置注销需要跳转的url,代码:
<bean id="logoutFilter" class="org.apache.shiro.web.filter.authc.LogoutFilter">
<property name="redirectUrl" value="/login-main.action" />
</bean>
2、将上述LogoutFilter加入shiro过滤器,可参考如下代码:
<property name="filters">
<map>
<entry key="logout" value-ref="logoutFilter" />
</map>
</property>