用tomcat做服务器,
在web应用的web.xml中配置了filter,来过滤所有用户请求,比如请求a.jsp。
在a.jsp中已经设置了禁止客户端缓存,如下:
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
现在的问题是当浏览器第一次点击链接到a.jsp的链接的时候,
在filter中拦截到了请求,在a.jsp中的system.out.print也可以输出内容。
但是当浏览器再次点击这个链接,filter拦截不到请求,a.jsp中都没有发现这个请求。
把这个链接地址贴在地址栏中,回车后,filter、a.jsp也没有拦截到这个请求,
只有在浏览器刷新a.jsp这个页面才能拦截到这个请求。现在我想要每次用户点击链接,都要在filter中拦截到这个请求,
该怎么做?

解决方案 »

  1.   

    filter配置信息应该有问题??
      

  2.   

    这是web.xml中filter的配置
    <filter>
    <filter-name>secureFilter</filter-name>
    <filter-class>
    interceptor.Guard
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>secureFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
      

  3.   

    up  up  up?
    咋办
    难道要每次发一个随机码过去?
      

  4.   

    贴一下你的filter的JAVA代码 interceptor.Guard
      

  5.   

    最后在每个请求jsp页面的时候,加一个随机字符串过去,
    让浏览器认为是一个新请求,就会每次访问服务器了