Problem
If a Web Page had a POST action submitted last and a User clicks the Browser F5 button or initiates a Browser refresh action, it cause the last action to be re-submitted, it could be a problem in your application as it would re-submit the previous POST request to the server.
Solution
While there could be many solution to handle it at various levels, in this post I am trying to capture various methods we can use while using JSF as Frontend UI technology. Each method is suitable for a specific use-case:
- Method-1<navigation-rule><from-view-id>/views/submitaction.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/views/successConfirmation.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule> - Method-2
<h:commandButton value="send" action="done?faces-redirect=true" /> - Method-3
If the requirement is to move from the original page to the same page after form submission. Ex.//In the Baking Bean have this code to return the String outcome:String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
return viewId + "?faces-redirect=true"; - Method-4 (if you want objects to survive redirection)For JSF1.2: By implementing PhaseListener:For JSF2.0: Using Flash scope (http://docs.oracle.com/javaee/6/api/javax/faces/context/Flash.html):
Thanks!
prudfiOclim-ne Cassandra Collins https://marketplace.visualstudio.com/items?itemName=9atlugifu.Descargar-Monsters-Loot-Swag-gratuita
ReplyDeletechaisamara
diftiFfrusso Rebecca Martinez https://www.miradaero.com/profile/burrowchatymdaniella/profile
ReplyDeletetiocuwepen
0verbiglabto Monica Fowler click here
ReplyDeleterimilemo
Nmedeunim_wo1978 Brent Dawson Download
ReplyDeleteblonanlibig