1

This is a snippit of my code in the form:

<p:commandButton styleClass="btn" action="#{testController.create}" value="create" ajax="false" />

Everything works fine but my problem is when i refresh the page (hitting f5), it invokes the create method again, is there any way to not invoke create method when refreshing the page? I need my button to have ajax="false"

galao
  • 1,281
  • 8
  • 26
  • 50
  • check your code for possible places that invoke that `create` method , like some `preRenderView` event, cause button isn't being executed by himself on page refresh just like that – Daniel Apr 04 '13 at 11:18
  • i'm pretty sure that theres no other places that is calling the create method. if i remove the ajax=false, hitting f5 wont invoke the method. – galao Apr 04 '13 at 11:27
  • also, hitting f5 gives me the alert window "the page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue?" this is if ajax=false is present – galao Apr 04 '13 at 11:28
  • Try to use [this script](http://stackoverflow.com/a/11412138/1659451) instead of giving ajax=false. – Ömer Faruk Almalı Apr 04 '13 at 12:14
  • possible duplicate of [How to avoid re-execution of last form submit action when the page is refreshed?](http://stackoverflow.com/questions/7850831/how-to-avoid-re-execution-of-last-form-submit-action-when-the-page-is-refreshed) – BalusC Apr 04 '13 at 12:50

0 Answers0