You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by da...@apache.org on 2026/02/26 13:01:12 UTC
(grails-core) 03/08: Add typed method-argument TagLib example to simple tags guide
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 1d708b15683d9a762dc735e7be389d8d210e85f4
Author: David Estes <da...@gmail.com>
AuthorDate: Wed Feb 25 21:43:08 2026 -0500
Add typed method-argument TagLib example to simple tags guide
Co-Authored-By: Oz <oz...@warp.dev>
---
grails-doc/src/en/guide/theWebLayer/gsp/taglibs/simpleTags.adoc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/grails-doc/src/en/guide/theWebLayer/gsp/taglibs/simpleTags.adoc b/grails-doc/src/en/guide/theWebLayer/gsp/taglibs/simpleTags.adoc
index 330422a336..cc1e37b945 100644
--- a/grails-doc/src/en/guide/theWebLayer/gsp/taglibs/simpleTags.adoc
+++ b/grails-doc/src/en/guide/theWebLayer/gsp/taglibs/simpleTags.adoc
@@ -33,6 +33,15 @@ The above uses Java's `SimpleDateFormat` class to format a date and then write i
<g:dateFormat format="dd-MM-yyyy" date="${new Date()}" />
----
+With method-based tags, attributes may also bind directly to method parameters by name:
+
+[source,groovy]
+----
+def dateFormat(String format, Date date) {
+ out << new java.text.SimpleDateFormat(format).format(date)
+}
+----
+
With simple tags sometimes you need to write HTML mark-up to the response. One approach would be to embed the content directly:
[source,groovy]