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 8442497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:51:32+00:00 2026-06-10T08:51:32+00:00

In one place in my system I do the following, which works correctly: log.debug

  • 0

In one place in my system I do the following, which works correctly:

   log.debug params."${tagType}"_${i}" //resolves to, e.g : params.title_0

Furthermore, the following also works:

log.debug params."${'setTagtypesList[0].tagtype.id'} // hard coded 0 index

(Note that above resolves to params.'setTagtypesList[0].tagtype.id' and that the single quotes are necessary.)

However the params request that follows results in NULL:

def someInt = 0
log.debug params."'setTagtypesList[someInt].tagtype.id'" //dynamic index

So how can I dynamically create a param name that contains array syntax? I’m using Grails 1.3.9.

  • 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-10T08:51:34+00:00Added an answer on June 10, 2026 at 8:51 am

    There are various ways to achieve what you want, including:

    params."setTagtypesList[${someInt}].tagtype.id"
    params['setTagtypesList[' + someInt + '].tagtype.id']
    

    Both of which are ultimately shorthand for

    params.get('setTagtypesList[' + someInt + '].tagtype.id')
    

    The thing to remember with GStrings is that anything inside ${} is a Groovy expression, anything outside the braces is taken literally.

    However note that

    params["setTagtypesList[${someInt}].tagtype.id"]
    

    Would likely not work, because it is looking up a map entry with a GString key rather than a String. The property access dot notation does an implicit toString() on the key before looking it up, this is one of the cases where you do need to be aware of the difference between Strings and GStrings.

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

Sidebar

Related Questions

List<T>.Sort() method has 3 overloads. One of them is the following System.Collections.Generic.List<T>.Sort(System.Comparison<T>) On seeing
Loading the image one time works as done in the following steps (for code
I have a template-esque system which can load bulk templates (more than one template
Can one place an arbitrary program (firefox, openoffice, etc...) in a QX11EmbedContainer? The fllowing
i have read in more then one place that using NHibernate's Identifier as Primary
How do I copy some directory from one place to another (not file by
Is it possible to move quickly from one place in code to another where
I have a hierarchy of templated classes that are constructed in one place and
Basically I'm trying to copy a file from one place to another but I
I like that Subversion 1.7 now has all the pristines in one place for

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.