Results 1 to 2 of 2

Thread: Associating error messages with fields that are map keys

  1. #1
    Join Date
    Apr 2005
    Location
    Edinburgh
    Posts
    18

    Default Associating error messages with fields that are map keys

    If I have a form object which has a Map, I can set map values using the syntax myMap['key'] for the field name, the question is, how can I associate an error message with this field using the Errors class (ie what would the field name be)?

    Cheers
    Daniel

  2. #2
    Join Date
    May 2005
    Location
    Paris - France
    Posts
    5

    Default Associating error messages with fields that are map keys

    Hello Daniel,

    to link an error message to a field held in a Map, you just have to name the field name the same way as you do in your view if you're using JSTL.

    For instance, you can use :

    Code:
    errors.rejectValue("myMap[key]", "errorMessage");
    Your command object must have the getter/setter for the 'myMap' attribute and 'key' must be valid.

    Hope this helps

    Vince

Similar Threads

  1. Replies: 2
    Last Post: Jul 14th, 2007, 09:05 AM
  2. Replies: 6
    Last Post: Sep 24th, 2006, 11:58 AM
  3. Replies: 2
    Last Post: Aug 4th, 2006, 01:37 PM
  4. Replies: 1
    Last Post: Sep 22nd, 2005, 04:42 AM
  5. Replies: 0
    Last Post: Jun 21st, 2005, 11:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •