0

When I enter the url through the browser for the first time, my servlet filter is hit. For example, appPages/Nav.xhtml?id=1 pasted first time in the browser does refresh the page. Now, when i change the query string to appPages/Nav.xhtml?id=2 also refreshes the page.

But the third time I enter appPages/Nav.xhtml?id=1 it still remembers the old stage and my filter is never called. In my web.xml I have configured the filter as

<filter>
    <display-name>SearchParamsFilter</display-name>
    <filter-name>SearchParams</filter-name>
    <filter-class>com.acme.filter.SearchParams</filter-class>
</filter>
<filter-mapping>
     <filter-name>SearchParams</filter-name>
     <url-pattern>/appPages/Nav.xhtml</url-pattern>
 </filter-mapping>

Why is it remembering the old state? This only happens when I enter the url in the same tab same window again. But a reload works fine.

UPDATE: It works fine on Chrome but not on IE!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Phoenix
  • 8,695
  • 16
  • 55
  • 88

1 Answers1

0

It may be caused by client-side caching. Make sure you disable caching by setting the appropriate response headers in your servlets and/or filters. See the following answers for detailed instructions:

How to prevent the result of Servlets from being cached?

Java servlet how to disable caching of page

Community
  • 1
  • 1
David Levesque
  • 22,181
  • 8
  • 67
  • 82