class SimpleTagLib {
static namespace = "my"
def example = { attrs ->
...
}
}
8.3.5 Tag Namespaces
Version: 3.2.6
8.3.5 Tag Namespaces
By default, tags are added to the default Grails namespace and are used with the g:
prefix in GSP pages. However, you can specify a different namespace by adding a static property to your TagLib
class:
Here we have specified a namespace
of my
and hence the tags in this tag lib must then be referenced from GSP pages like this:
<my:example name="..." />
where the prefix is the same as the value of the static namespace
property. Namespaces are particularly useful for plugins.
Tags within namespaces can be invoked as methods using the namespace as a prefix to the method call:
out << my.example(name:"foo")
This works from GSP, controllers or tag libraries