In my Play app, I have several actions (e.g. "Delete" an entity) that can be triggered from different pages. After the action is triggered, I'd like to redirect the user back to the page they were on before I performed the action. Is there a good pattern to use for this in Play?
you can easily use @request.getHeader("referer")
in your Templates, for example if you have a cancel button that should redirect you to the previous page, use this :
<a href="@request.getHeader("referer")">Cancel</a>
in this way, you don't need to pass any extra information to your templates. (tested with play 2.3.4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With