我是Grails的新手,我有一个问题对大多数人来说应该很容易.
我有一个显示object列表的页面.我想,如果有一个显示的消息DataIntegrityViolation时object被删除.我在做的是:
def delete() {
def instanceToDelete= Myobject.get(params.id)
try {
instanceToDelete.delete(flush: true)
redirect(action: "list", id: params.id)
}
catch (DataIntegrityViolationException e) {
flash.message = "some message"
//I want to refresh the div containing the flash.message here
}
}
Run Code Online (Sandbox Code Playgroud)
这是应该显示flash消息的位置:
<g:if test="${flash.message}">
<div class="alert alert-error" style="display: block">${flash.message}</div>
Run Code Online (Sandbox Code Playgroud)
对不起 - 我知道这是一个愚蠢的问题,但我真的找不到解决方案.
grails ×1