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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:52:58+00:00 2026-05-27T09:52:58+00:00

I’m trying to use command objects in the following way: class BeneficiaryCommand { List<Beneficiary>

  • 0

I’m trying to use command objects in the following way:

class BeneficiaryCommand {
    List<Beneficiary> tempBeneficiaries = org.apache.commons.collections.list.LazyList.decorate(new ArrayList(), new org.apache.commons.collections.functors.InstantiateFactory(Beneficiary.class))

    static constraints = {
        tempBeneficiaries(validator: {
            it.each{println it.beneficiary} // it.beneficiary is null, but I expect it to have name and address from the form
        })
    }
}

class Beneficiary {
    Contractor beneficiary // Contractor has name and address properties, both non-blank and non-nullable
    Boolean save
}

The GSP looks like:

<tr class="prop">
    <td valign="top" class="name">
      <label for="beneficiaries"><g:message code="contract.beneficiaries.label" default="New Beneficiary Name" /></label>
    </td>
    <td valign="top" class="value ${hasErrors(bean: i, field: 'name', 'errors')}">
        <g:textField name="tempBeneficiaries[0].name" />
    </td>
</tr>

<tr class="prop">
    <td valign="top" class="name">
      <label for="beneficiaries"><g:message code="contract.beneficiaries.label" default="New Beneficiary Address" /></label>
    </td>
    <td valign="top" class="value ${hasErrors(bean: i, field: 'address', 'errors')}">
        <g:textField name="tempBeneficiaries[0].address" />
    </td>
</tr>

<tr class="prop">
    <td valign="top" class="name">
        </td>
    <td valign="top" class="value ${hasErrors(bean: beneficiaryCommand, field: 'save', 'errors')}">
        <div id="newBeneficiaryFlagDisplay"><g:checkBox name="tempBeneficiaries[0].save" /> Create new Beneficiary</div>
    </td>
</tr>

The save property of the command object (represented by the checkbox) is bounded to the command object, but the name and address are not. I have also tried renaming the text field names to tempBeneficiaries.beneficiary[0].name to no avail.

Any ideas on how to capture name and address into the command object?

  • 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-05-27T09:52:59+00:00Added an answer on May 27, 2026 at 9:52 am

    From the hierarchy of your command object the name of the field should be tempBeneficiaries[0].beneficiary.name and tempBeneficiaries[0].beneficiary.address

    This is the LazyList syntax I’ve used before to do something similar, but I don’t know if your syntax is an issue at all:

    List<Beneficiary> copies = ListUtils.lazyList([], FactoryUtils.instantiateFactory(Beneficiary))
    

    Also, you might try

    Contractor beneficiary = new Contractor()
    

    in your Beneficiary class so that an object is available at object creation time to be populated.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put

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.