Skip to content

Issue 15254 docs issues tag library documentation - #15304

Merged
matrei merged 7 commits into
apache:7.0.xfrom
dauer:issue-15254-docs-issues-tag-library-documentation
Jan 15, 2026
Merged

matrei merged 7 commits into
apache:7.0.xfrom
dauer:issue-15254-docs-issues-tag-library-documentation

Conversation

@dauer

@dauer dauer commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Fixes

  • Examples of using inherited properties in Tag Libraries uses Controllers (except in pageScope page)
  • Links are broken in request, response, servletContext and session pages

As reported in this issue #15254

Issue:
    apache#15254

Fixes:
 - Links are broken in 'request', 'response', 'servletContext'
   and 'session' pages
Examples of using inherited properties in Tag Libraries used
Controllers, now they are TagLib examples
@jdaugherty

jdaugherty commented Dec 26, 2025 •

Copy link
Copy Markdown
Contributor

FYI: The tests failed due to the ASF repo being down (unrelated to this PR).

@matrei matrei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on!

Comment thread grails-doc/src/en/ref/Tag Libraries/flash.adoc Outdated
Comment thread grails-doc/src/en/ref/Tag Libraries/pageScope.adoc Outdated
Comment thread grails-doc/src/en/ref/Tag Libraries/servletContext.adoc Outdated
Comment thread grails-doc/src/en/ref/Tag Libraries/session.adoc Outdated
dauer and others added 4 commits January 13, 2026 18:23
Co-authored-by: Mattias Reichel <mattias.reichel@gmail.com>
Co-authored-by: Mattias Reichel <mattias.reichel@gmail.com>
Co-authored-by: Mattias Reichel <mattias.reichel@gmail.com>
Comment on lines +38 to +54
// List all attributes and their values for the current session
def listSessionAttributes = { Map params ->
out << params.get("name") << ' : ' << session.getAttribute(params.get("name"))
}

}
----

[source,xml]
----
<ul>
<g:each var="elm" in="${session.getAttributeNames()}">
<li><g:listSessionAttributes name="${elm}" /></li>
</g:each>
</ul>
----

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I struggle to see the logic in this example. Making easy/clear examples is hard.

Suggestion:

class ExampleTagLib {

    def oncePerSession = { Map attrs, body ->

        def key = (attrs.key ?: 'default').toString()
        def sessionKey = "taglib.oncePerSession.${key}"

        if (!session.getAttribute(sessionKey)) {
            session.setAttribute(sessionKey, true)
            out << body()
        }
    }
}
<g:oncePerSession key="promo">
    <div class="promo">Free shipping this week!</div>
</g:oncePerSession>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@jdaugherty jdaugherty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such an improvement already, I'm good with it. I like Mattias's suggestion on the better example too.

@matrei matrei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@matrei
matrei merged commit 9ae247f into apache:7.0.x Jan 15, 2026
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants