views:

311

answers:

1

For example, i can put

 <g:createLink controller="user" action="show" />

inside a .gsp file and it will work nicely.

But also I'd like to use the same closure createLink inside a .groovy file which is not part of the grails views

+5  A: 

You can use taglib methods from Grails controllers, for example:

def userShow = g.createLink(controller:"user", action:"show")

For builtin taglibs (or those in the g namespace) you can omit the namespace prefix in the method call.

John Wagenleitner