Grails 附加到具有相同键的查询字符串
我正在尝试使用相同的键向查询字符串添加一些部分 我有一个类似Grails 附加到具有相同键的查询字符串,grails,query-string,Grails,Query String,我正在尝试使用相同的键向查询字符串添加一些部分 我有一个类似http://server.com/search/result?query=hello带有一些控件,这些控件应向查询字符串中添加一个协作者 这是通过以下方式完成的: <g:link action="result" params="${params + ['collaborator': collaborator.id]}">${collaborator.name}</g:link> ${collaborator.
http://server.com/search/result?query=hello
带有一些控件,这些控件应向查询字符串中添加一个协作者
这是通过以下方式完成的:
<g:link action="result" params="${params + ['collaborator': collaborator.id]}">${collaborator.name}</g:link>
${collaborator.name}
返回:http://server.com/search/?query=hello&collaborator=
这很好,但是可以选择更多的合作者。如何将另一个&collaborator=
附加到查询
我尝试过各种方法,如${params+[params.collaborator+collaborator.id]}
,但这只将它们放在一个字符串中。尝试以下方法:
普惠制:
<g:link action="result" params="${params + ['collaborator': params.list('collaborator') + [collaborator.id]]}">${collaborator.name}</g:link>
List collaboratorList = params.list('collaborator')
//Your operations on this list