hi,
i'm using grails 2.0.3 with java 1.6.0_45-b06 and groovy-compiler 1.8.6.
in my controllers/services i'm using try...catch blocks when doing database stuff. i'd like to show a confirm-message, if an operation was successful or an error message if not. here's my code:
controllers/services:
view:
the logging does work perfectly, but no flash-message is shown...?! Neither the flash.confirm, nor the flash.error when provoking database operation to fail...
i really have no idea at the moment, why no flash message is shown... and would be very thankful if someone has a clue!
thanks a lot!
i'm using grails 2.0.3 with java 1.6.0_45-b06 and groovy-compiler 1.8.6.
in my controllers/services i'm using try...catch blocks when doing database stuff. i'd like to show a confirm-message, if an operation was successful or an error message if not. here's my code:
controllers/services:
Code:
SomeDomainObject.withTransaction { status ->
try {
//doing db-stuff...
//....
log.info("Log something")
flash.confirm = message(code: 'some.message.code')
} catch(e) {
status.setRollbackOnly()
log.error("Log the error" + e)
flash.error = message(code: 'some.other.code')
}
}
redirect action: 'anAction'
Code:
<g:if test='${flash.confirm}'>
<div class='confirmDiv'>${flash.confirm}</div>
</g:if>
<g:if test='${flash.error}'>
<div class='errorDiv'>${flash.error}</div>
</g:if>
i really have no idea at the moment, why no flash message is shown... and would be very thankful if someone has a clue!
thanks a lot!