簡體   English   中英

將參數傳遞給Grails映射

[英]Passing parameter to grails mapping

我已命名映射,我正在嘗試將參數傳遞給該映射。 當我在gsp中使用grails標記時,已經用Google搜索/查看了關於此問題的許多答復:

<g:link mapping="accountDetails" params="[acctNumber:'8675309']">

我試圖在我的g.link中使用g.link而不是<g:link ,並且出現異常。 這是我的標簽庫中的行:

String otherProfileLink = g.link(mapping:"browseProfile", params:"['profileId':'123']", "my link text")

在我的URLMappings中:

 name browseProfile: "/browseProfile/$profileId" {controller = 'search'; action = 'show'}

例外是:

Unable to create URL for mapping [/browseProfile/(*)] and parameters [{controller=message, action=index}]. Parameter [profileId] is required, but was not specified!

我已經嘗試過對params值進行一些變體,帶或不帶引號,帶/不帶閉包。 但是到目前為止沒有運氣。

您是否嘗試過:

g.link(mapping:"browseProfile", params: [profileId:'123']) { "my link text" } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM