Grails

Using TagLib to avoid changes due to change in URLMappings

Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -> def user = User.read(attrs.id) out << g.link(controller: 'user', action: 'show', params: [name: user.name]) {body()} } [/java] So wherever I need a link to user page, I...

by Mohd Farid
Tag: url mappings
14-Feb-2011

Grails

Grails: reverse url mapping to generate urls ending with “.html”

Hi Friends, Recently I came across a problem, where the url of the links were to be generated dynamically based on the controller and action to be executed and  should end with ".html". Reverse url mappings came to my rescue, which can be implemented using <g:link> GSP tag. Then I tried this, In UrlMappings.groovy file : ...

by Amit Jain
Tag: url mappings
28-Aug-2009

Grails

Restricting all URLs to end with .html in a Grails Application

While going through the grails-users mailing list, I found a question about restricting all URLs to end with '.html' & returning Error 404 for the default mappings. After spending some time, I was able to build a sample CRUD application restricting URLs to end with .html. I did the following steps for the same: 1. Create a new...

by Aman Aggarwal
Tag: url mappings
03-Apr-2009