0

嗨朋友们,我是 struts2 中的新蜜蜂,我正在开发应用程序,其中我使用了会话超时拦截器,我的问题是超时没有发生下面是我引用代码的链接 http://knowledge-serve.blogspot.in/2011 /10/session-timeout-interceptor-in-struts-2.html

这个问题可能是因为我有一些 javascript 不断运行以刷新列表。或者可能是我错了,但这个会话没有过期

请帮帮我,谢谢

4

2 回答 2

0
<interceptors>
       <interceptor name="SessionCheckInterceptor"  class="com.vicwalks.web.interceptor.SessionCheckInterceptor"/>        
      <interceptor-stack name="testSessionValidationStack">
                <interceptor-ref name="defaultStack" />               
                <interceptor-ref name="SessionCheckInterceptor" />
      </interceptor-stack> 

</interceptors>

struts.xml拦截器的顺序很重要。尝试更改 . 的顺序。因为在defaultStack and SessionCheckInterceptor您的代码中defaultstack不会首先调用。因为您不会sessionMapsessionCheckInterceptor.

于 2012-09-26T12:44:31.350 回答
0

正如 MayurB 正确指出的那样,您只需要交换堆栈。你也可以使用

HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
HttpSession httpSession = request.getSession(false);

这将在 defaultStack 之前可用

于 2012-09-26T12:52:13.307 回答