Skip to content

Issue 15254 docs issues tag library documentation#15304

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

Issue 15254 docs issues tag library documentation#15304
matrei merged 7 commits intoapache:7.0.xfrom
dauer:issue-15254-docs-issues-tag-library-documentation

Conversation

@dauer
Copy link
Copy Markdown
Contributor

@dauer dauer commented Dec 23, 2025

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
Copy link
Copy Markdown
Contributor

jdaugherty commented Dec 26, 2025

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

Copy link
Copy Markdown
Contributor

@matrei matrei left a comment

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

Copy link
Copy Markdown
Contributor

@jdaugherty jdaugherty left a comment

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.

Copy link
Copy Markdown
Contributor

@matrei matrei left a comment

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