在Spring中登录后避免后退按钮

时间:2014-10-10 13:51:40

标签: java spring jsp spring-mvc

我正在寻找一个特定的Spring功能,可以在注销后使用后退按钮阻止用户返回限制区域。我找不到任何东西。

是否有特定的Spring功能来处理我的问题,或者我应该使用response.setHeader(.....等?

1 个答案:

答案 0 :(得分:1)

春天没有直接功能,您可以使用interceptor来完成这项工作。与servlet过滤器相同,将cacheSeconds设置为0

<mvc:annotation-driven/>
<mvc:interceptors>
    <bean id="webContentInterceptor" 
          class="org.springframework.web.servlet.mvc.WebContentInterceptor">
        <property name="cacheSeconds" value="0"/>
        <property name="useExpiresHeader" value="true"/>
        <property name="useCacheControlHeader" value="true"/>
        <property name="useCacheControlNoStore" value="true"/>
    </bean>
</mvc:interceptors>

这解释了WebContentInterceptor。还有nice expalanation这里。

相关问题