What does .flashing do on Play! 2?

Can someone explain what Flash Scope is? What does .flashing () do and how to use both of them?

+4
source share
2 answers

Rough flashing is useful when you need a time parameter. A common case is a message that will be displayed on the next page using redirection

This is very useful when you need the informational part of the workflow, but you do not want them to be part of the contract declared by the template (parameters).

The collapsed information is stored in a cookie not hashed (in explicit form), and its lifetime is limited by the very next request - it is discarded after.

The way to use blink is to simply use blink, which represents a sequence of kvp lines, such as Redirect (route.Application.login ()). Blinking ("error", "You must be logged in")

If the login uses a template for rendering, which contains @ flash.get ("error") map {x => @ X}

+8
source

Flash is usually used with redirection, but is not attached to it. Essentially, the Flash realm works just like Session, but with two differences:

  • data is saved for only one request
  • Flash cookie is not signed, which allows the user to modify it.

POST / Redirect / GET is the main cause of blinking.

0
source

All Articles