"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Tag Libraries/flash.html" (14 Sep 2022, 59489 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)

flash

Purpose

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.

Examples

class BookController {

    def index() {
        flash.message = "Welcome!"
        redirect(action: 'home')
    }

    def home() {}
}

Description

The flash object is a Map (a hash) which you can use to store key value pairs. These values are transparently stored inside the session and then cleared at the end of the next request.

This pattern lets you use HTTP redirects (which is useful for redirect after post) and retain values that can be retrieved from the flash object.