2014-01-29 66 views
1

我已命名映射我試圖傳遞一個參數給。將參數傳遞給grails映射

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

我試圖使用g.link,在我的taglib不<g:link和我得到一個例外:當我用Google搜索/在GSP使用Grails的標籤時,看到在這個問題上很多回應。這是我的標記庫行:

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值有一些變化,有和沒有引號,有/沒有關閉。但到目前爲止沒有運氣。

回答

1

你有沒有嘗試過這樣的:

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

是的,就是這樣。抨擊報價。 – spock99