6.4.7 Automatic Link Re-Writing - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith
Version: null
6.4.7 Automatic Link Re-Writing
Another great feature of URL mappings is that they automatically customize the behaviour of the link tag so that changing the mappings don't require you to go and change all of your links.
Otra gran mejora del mapeo de URL es que se puede personalizar automaticamente el comportamiento de la etiqueta link asi que cambiar los mapeos no requiere de ir y cambiar todos sus enlaces.
This is done through a URL re-writing technique that reverse engineers the links from the URL mappings. So given a mapping such as the blog one from an earlier section:
Esto es hecho a travez de la tecnica de reescritura de la URL que hace ingenieria inversa a los links de los mapeos de URL. Asi que dado un mapeo tal como el blog de la seccion anterior:static mappings = { "/$blog/$year?/$month?/$day?/$id?"(controller:"blog", action:"show") }
If you use the link tag as follows:
Si usted usa la etiqueta de enlance como sigue:<g:link controller="blog" action="show" params="[blog:'fred', year:2007]"> My Blog </g:link><g:link controller="blog" action="show" params="[blog:'fred', year:2007, month:10]"> My Blog - October 2007 Posts </g:link>
Grails will automatically re-write the URL in the correct format:
Grails automaticamente reescribira la URL en el formato correcto:<a href="/fred/2007">My Blog</a> <a href="/fred/2007/10">My Blog - October 2007 Posts</a>

