-1

I made a JSF web application. It was generated in netbeans ide.

To prevent pages being unresponsive I've set pages to auto-refresh in a set time interval.

I have a list page like this List of records

And I can create a record like this create a record

Say, I have set auto-refresh to every 30 seconds. I create a new record and return to list page. After 30 seconds it will give me this error: "Resubmit form? To refresh this page, your browser needs to repeat any actions you've already taken. For example, if you've already entered info into a form, your info will be resubmitted to the site".

This only happens if I access from another computer. From localhost it just redirects to list page without error popping up.

It seems like when I click to load create page, this action is remembered and when list page is refreshed it refreshes the create page.

Logan Lee
  • 807
  • 9
  • 21
  • _"To prevent pages being unresponsive I've set pages to auto-refresh in a set time interval."_ - and what on earth did make you think that was a good idea? "Sure, we could try and build a car engine that will run efficiently for miles and miles and miles ... but, what if ... drumroll ... we just switched out the engine for a new one every 30 seconds?" - "Well, you Sir, are an engineering genius, how did we not think of that ..." – CBroe Oct 21 '17 at 01:55
  • it's just an example... i can set list page to refresh every 1 hour and after an hour it will pop up the same error. – Logan Lee Oct 21 '17 at 01:57
  • Well then do some basic research please, you are not the first person facing the problem of unwanted form re-submission confirmation. https://www.google.com/search?q=page+reload+form+submit+confirm – CBroe Oct 21 '17 at 01:59
  • this seems like my problem: https://stackoverflow.com/questions/7850831/how-to-avoid-re-execution-of-last-form-submit-action-when-the-page-is-refreshed but in my case add or delete action is not replicated just the error message. – Logan Lee Oct 21 '17 at 02:20

1 Answers1

0

I fixed it by redirecting to index after submitting.

FacesContext.getCurrentInstance().getExternalContext().redirect("../../faces/index.xhtml");
Logan Lee
  • 807
  • 9
  • 21