This is an automated email from the ASF dual-hosted git repository. davydotcom pushed a commit to branch feature/taglib-method-actions in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 106c92c8418272fbbd5fbd00ff4817d5773e8c20 Author: David Estes <[email protected]> AuthorDate: Wed Feb 25 21:42:25 2026 -0500 Document typed attribute-to-argument binding for method TagLib syntax Co-Authored-By: Oz <[email protected]> --- grails-doc/src/en/guide/theWebLayer/gsp/taglibs.adoc | 18 ++++++++++++++++++ grails-doc/src/en/guide/theWebLayer/taglibs.adoc | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/grails-doc/src/en/guide/theWebLayer/gsp/taglibs.adoc b/grails-doc/src/en/guide/theWebLayer/gsp/taglibs.adoc index 54b5a5d71a..e9d6e2ad4c 100644 --- a/grails-doc/src/en/guide/theWebLayer/gsp/taglibs.adoc +++ b/grails-doc/src/en/guide/theWebLayer/gsp/taglibs.adoc @@ -53,6 +53,24 @@ class SimpleTagLib { } ---- +For method-based tags, named attributes can also bind directly to method signature arguments: + +[source,groovy] +---- +class SimpleTagLib { + def greeting(String name) { + out << "Hello, ${name}!" + } +} +---- + +Used as: + +[source,xml] +---- +<g:greeting name="Graeme" /> +---- + As demonstrated above there is an implicit `out` variable that refers to the output `Writer` which you can use to append content to the response. Then you can reference the tag inside your GSP; no imports are necessary: [source,xml] diff --git a/grails-doc/src/en/guide/theWebLayer/taglibs.adoc b/grails-doc/src/en/guide/theWebLayer/taglibs.adoc index 692fde9aca..e3d14b35ef 100644 --- a/grails-doc/src/en/guide/theWebLayer/taglibs.adoc +++ b/grails-doc/src/en/guide/theWebLayer/taglibs.adoc @@ -53,6 +53,24 @@ class SimpleTagLib { } ---- +For method-based tags, named attributes can also bind directly to method signature arguments: + +[source,groovy] +---- +class SimpleTagLib { + def greeting(String name) { + out << "Hello, ${name}!" + } +} +---- + +Used as: + +[source,xml] +---- +<g:greeting name="Graeme" /> +---- + As demonstrated above there is an implicit `out` variable that refers to the output `Writer` which you can use to append content to the response. Then you can reference the tag inside your GSP; no imports are necessary: [source,xml]
