As I have said before, I love how easy it is to create links in Grails. However, when I was starting out I could never remember the syntax when I needed more information on the URL than just the ID.
Lets say I have a UrlMapping (grails-app/conf/UrlMapping.groovy) of:
"/player/photos/$id?/matchReport/$matchReportId?" { controller = "player" action = "photos" }
I always had problems remembering how to get the matchReportId onto the URL. As with so many things in Grails it turns out to be very simple; use the params parameter:
<g:link controller="player" action="photos" id="${matchPlayer.player.id}" params="[matchReportId:matchPlayer.matchReport.id]">
and good ol’ Grails is smart enough to build the URL like
rfw/player/photos/6/matchReport/26