The flash object is a map and one of the more common use cases for flash scope is to store a message that will display when some form of validation fails.
Storing a Message in Flash Scope

flash object implements java.util.Map, so all the regular methods of this class are
also available.

Please note that flash is a temporary storage map that stores objects within the session for the next request and the next request only, automatically clearing out the objects held there after the next request completes.

The flash scope expire if the user requests some other page at your site after the first request is processed. And the second page will show nothing again.

Thus, the flash scope can be used safely only for HTTP redirects. And it is very useful feature for that.