grails - 调试时如何在gsp中监视变量?

标签 grails grails-plugin grails-2.0

我正在编写Grails应用程序,但出现错误。

我必须调试.gsp文件,我有一个像$ {itemId}这样的变量。我想看这个值。我怎样才能做到这一点?它不会出现在“变量”选项卡中。

我在表达式中添加了$ {itemId},但没有输出。

最佳答案

没有效率,但可以使用

<% println('${itemid}'); %> 

在.gsp文件中。但是,请确保已将变量或类似形式的变量传递给 View 。不要忘记放置一个断点。
def testController() {
   .
   .
   .
   .
  //other codes here

 [itemid:yourmodel.id, //otherstuffs here]   
}

关于grails - 调试时如何在gsp中监视变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21672752/

相关文章:

grails - 使用Groovy读取输入xml和构造输出xml时出错

mongodb - 多个数据源和 Multi-Tenancy 之间有什么区别?

spring-security - 无法在 Windows 7 上的 GGTS 中使用 Spring Security Core 运行 Grails 项目

chalice : getting assets local storage path inside the controller

grails - Grails的理解属于TotalTo协会

grails - 如何防止页面重新提交?在grails 2.2.0中

unit-testing - 由于错误,无法测试我的 grails 应用程序

java - grails - 域类中的继承 - 将列继承到基表中

grails View 参数与非域类绑定(bind)

grails - Groovy 中的闭包与委托(delegate)