grails - 如何在JavaScript中使用groovy Controller 元素

标签 grails gsp

我有

def exception = request.exception.stackTraceLines

在Groovy Controller 中。如何在JavaScript中获取exception的值。

最佳答案

如果您要将异常(exception)添加到这样的返回中。

flash.message = message(exception: 'Error: xxx');

你可以这样得到
<div class="message" role="status"> ${flash.message} </div>

只需使用$ {您的flash.your_var_name}

关于grails - 如何在JavaScript中使用groovy Controller 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12783794/

相关文章:

grails - Grails:在taglibs中使用actionName和pageScope.actionName有什么区别?

grails - 在Grails GSP布局内使用其他布局

eclipse - 在STS(Eclipse)IDE的All Gsp文件中包括.js文件?

grails - Grails GSP View 将不会输出变量

json - 如何在gsp每个标签中遍历json?

grails - Grails-在运行时覆盖消息 bundle 属性

grails - 从Grails中的数据库渲染数据时出错

grails - Grails URL映射在GSP上导致错误

javascript - 从JavaScript V.S GSP调用Grails操作

grails - Grails hasMany关系查询