• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

Browser refresh/reload

I have a report  displayed by selecting records from a database. When user click on refresh/reload, I don't want server to re-select the data again.

Is there anyway to know at the server that user has clicked on refresh/reload button?

3 Solutions
You can *trick* it to use caching.

Look at the OSCache from OpenSymphony

Have a hidden field in your form, submit the form thorugh a javascript function after setting some value for the hidden field. The trick here is that the javascript will be executed only when the user clicks on your submit button and not when the page is refreshed using refresh button. So, on the server side if the hidden field's value is not set, you know that the user refreshed the page.
I've been storing my results in session if I already retreived it.  This works best if the data does not get refreashed that often.  Otherwise you can set a 30 - ?? second timeout to restore the data.  

I hope this helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now