Results 1 to 3 of 3

Thread: Error Message Codes for Validator

  1. #1

    Default Error Message Codes for Validator

    Im just trying to implement my first SimpleForm with Validation. Almost working but in my Validator Im adding code of the form:
    Code:
    errors.rejectValue("description",null,"This value cannot be left blank");
    errors.rejectValue("description","ERR1","This value cannot be left blank");
    This error code doesnt map to anything and although ive provided a default message it doesnt like it
    Code:
    org.springframework.context.NoSuchMessageException: No message found under code 'null.DataItem.description' for locale 'en_GB'.
    Whilst I think having error codes is an excellant idea I cant quite see what I am meant to do to set them up do I creates a MessageCoderesolver or something.
    [/code]

  2. #2
    Join Date
    Feb 2005
    Location
    Canberra, Australia
    Posts
    3

    Default

    I had the same problem. If you supply an empty message.properties file, and set a messageSource, it should go away.

    I put this in the application context.

    Code:
    	<!-- Message source for this context, loaded from localized "messages_xx" files -->
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basename"><value>messages</value></property>
    	</bean>
    And then put a file called messages.properties in the classpath.
    --
    Steven Farlie
    Jabber: steven@cternetlabs.com

  3. #3

    Default

    Thanks, that works

    Could some point me to how to do this properly now

Similar Threads

  1. Replies: 5
    Last Post: Oct 27th, 2006, 12:41 PM
  2. Replies: 1
    Last Post: Jun 16th, 2005, 04:25 AM
  3. Loading Data from Codes Table
    By knchs in forum Data
    Replies: 1
    Last Post: Apr 19th, 2005, 04:59 AM
  4. Replies: 3
    Last Post: Feb 13th, 2005, 08:44 AM
  5. Replies: 1
    Last Post: Nov 23rd, 2004, 08:19 PM

Posting Permissions

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