I’m new to Grails, and I have a question that should be easy for most of you.
I have a page displaying an object
list. I want to display a message if there’
The flash
object is a Map
which stores key/value pairs, so you can define your own key for error messages. For example:
try {
instanceToDelete.delete(flush: true)
flash.message = "successfully deleted object"
}
catch (DataIntegrityViolationException e) {
flash.error = "could not delete object"
}
redirect(action: "list", id: params.id)
Then you can check the flash
object containing the error
key, and use a different style for that kind of message:
${flash.error}