Can someone explain what the Flash Scope is? What does .flashing() do and how to use both of them?
Roughly flashing is useful in the cases you need a temporary parameter. Common case is a message to be displayed to the next page accessed using a redirect
This is very useful when you need information part of a workflow but which you don't want them to be part of the contract declared by a template (parameters).
A flashed information is stored in the cookie not hashed (in clear thus) and its lifetime is scoped to the very next request -- discarded after.
The way to use flashing is simply use flashing which a sequence of strings kvp, like so Redirect(routes.Application.login()).flashing("error", "You must be logged in")
Where login is using a template to be rendered which contains @flash.get("error") map { x => @x }
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