Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8732483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:26:55+00:00 2026-06-13T09:26:55+00:00

I have defined a taglib like this: class FooTagLib { static namespace = foo

  • 0

I have defined a taglib like this:

class FooTagLib {
    static namespace = "foo"

    def bar = { attrs, body ->
        out << render(template: "/taglib/foo/bar", model: [body: body])
    }
}

The body closure takes two parameters, baz and qux, why can’t I do this in my /taglib/foo/_bar.gsp:

${body(baz: 'Hello', qux: 'world!')}

?

This is how I use this tag in my gsp views:

<foo:bar>
    ${baz} ${qux}
</foo:bar

It prints the content of the body, but the parameters are all null:

null null

Is this a bug or is there something I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:26:56+00:00Added an answer on June 13, 2026 at 9:26 am

    Inside the taglib you never specify any params, it is not done automatically, because the taglib does not know the names of the map keys. You must specify the map keys and values in the model.

    class FooTagLib {
        static namespace = "foo"
    
        def bar = { attrs, body ->
            def s = body()
            def tokens = s.tokenize()
            out << render(template: "/taglib/foo/bar", model: [body: [baz:tokens[0], qux:tokens[1]] ])
        }
    }
    

    Maybe the body-tokenize is not really what you should be doing, but it was just to make things clear.

    It would be easier for you to use attrs, instead of building the body closure with params.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined a rectangle drawable like this: <shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=rectangle> <corners android:radius=4dip/> <solid
I have defined c:/temp/t.py as follows: class MyClass(object): def __init__(self): self._my_secret_thing = 1 def
I have defined this class: class Trade(Base): __tablename__ = 'TRADE' __table_args__ = {'quote':False} id
I have defined a static resource: <UserControl x:Class=MyProject.MainPage xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:sys=clr-namespace:System;assembly=mscorlib mc:Ignorable=d
I have defined an AIDL file with my interface. Something like this: interface IResPlugin
I have defined new member in my class protected COMObject.Call call_ = null; This
I have defined this mapping: public class Mapping : ConventionModelMapper { public Mapping() {
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:
I have defined a ConfigurationProperty class, which is basicly a key-value pair (with key
I have defined an array like so : var myArray = {myNewArray: ['string1' ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.