1

I have a search page for an internal webapp that has several JSF components on the page. When the user clicks on the form submit, a number of results are displayed with links to other pages. My problem is that when one of these links is clicked, then the back button is clicked, the previous page appears to be missing the information that was entered in the form. However, if the page is refreshed, the components rerender with all the information visible.

Is there a way to get the components to rerender or the page to refresh automatically? (I don't want to send another request to the server. I want to use the page from the browser cache, which is what appears to be happening. I confirmed using Firebug that no POST request is submitted from the browser on refresh. I primarily want the components to rerender as they were.)

I've read a number of similar questions here and elsewhere, but none of them seemed to hold an answer. Perhaps I'm missing something obvious.

Feanor
  • 2,715
  • 4
  • 29
  • 43

1 Answers1

1

See answer here:

javax.faces.application.ViewExpiredException: View could not be restored

Particularly the part about adding a Filter with:

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.
chain.doFilter(request, response);

That will force the page to be reloaded when the user uses the back button.

Community
  • 1
  • 1
Dave Maple
  • 8,102
  • 4
  • 45
  • 64