【问题标题】:Inserting values into grails createlink params on page creation在页面创建时将值插入 grails createlink 参数
【发布时间】:2016-07-09 17:07:02
【问题描述】:

我有一个列表视图,对于每一行,我想要一个指向另一个列表视图的链接,以显示相关结果。我终于设法构建的 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

我错过了什么?

我的想法是,然后我有一个像这样的控制器,然后应该列出与该 id 匹配的那些项目...

def ListSpecific(int id){

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

【问题讨论】:

    标签: grails params


    【解决方案1】:

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

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

    享受吧。

    【讨论】:

    • 该死的我知道花了一个小时与它搏斗后会很明显哈哈!干杯! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 1970-01-01
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多