Hi all,

I have a problem with an AJAX behavior that I have on a stateful page. The 
behavior is triggered by the user by clicking a button (the button is outside 
my control).
The behavior then does some backend action on the server and afterwards reloads 
the page (by calling RequestCycle.get().setResponsePage(page.getPageClass(), 
page.getPageParameters());, where page is the the current page).
My problem now is that it can happen that the user clicks the button twice 
which results in the following sequence of calls:

1.       First behavior is triggered on page version 1

2.       Backend action is done

3.       Server sends 302 to reload page

4.       Second behavior is triggered (still for page version 1)

5.       Backend is done for second behavior

6.       Client cancels AJAX request for second behavior, because of the page 
redirect -> so no additional page reload here

7.       Page render is triggered by the page reload

My goal is to always reload the page if the backend action is triggered, 
because the page's state depends on the backend state.
So either the second behavior should not be triggered at all or it should be 
correctly executed (meaning backend action AND page reload should be triggered).
How can I achieve this?

Best regards,
Sebastian

Reply via email to