grails - 在页面创建时将值插入到 grails createlink 参数中

标签 grails params

我有一个 ListView ,对于每一行,我想要一个链接到另一个显示相关结果的 ListView 。我最终设法构建的 createlink 行看起来像这样

<a href="${createLink(controller : 'RunResults', action:'ListSpecific', params:'[id:testExecQueueInstance.id]')}">my link</a>

这将生成链接
http://localhost:3278/FARTFramework/runResults/listSpecific/testExecQueueInstance.id

我知道 testExecQueueInstance.id 是 22,我希望链接实际上看起来像这样
http://localhost:3278/FARTFramework/runResults/listSpecific/22

我错过了什么?

这个想法是,然后我有一个像这样的 Controller ,然后它应该列出与该 ID 匹配的那些项目......
def ListSpecific(int id){

    render(view: "list", model: [runResultsInstanceList: RunResults.findAllByTestExeQueueID(id, [sort:"testExecTime", order: "desc"]), runResultsInstanceTotal: RunResults.count()])
}

最佳答案

您在参数映射上使用撇号。
你应该试试这个。

<a href="${createLink(controller : 'RunResults', action:'ListSpecific', params: [id:testExecQueueInstance.id])}">my link</a>

请享用。

关于grails - 在页面创建时将值插入到 grails createlink 参数中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18785500/

相关文章:

grails - 一个vs多个复选框

validation - Grails:更改属性名称 “errors”

date - Groovy 无法将字符串解析为日期

grails - 如何从服务调用 log.error()?总是给出“没有这样的属性 : log for class: gi. mypackage.$UserServiceImplementation

ruby-on-rails - 如何在rails中将数组保存到数据库

ruby-on-rails - Rails:使用参数重定向

xml - 自定义 Antisamy 策略 xml 以允许更多 html 和 grails 标签

grails - 编译类中的 neverHappen 变量

带有参数 * 和 * 函数的 Powershell 脚本

date - 如何在 Grails 中将日期值作为参数传递