Adding custom messages to the store error message properties

In this step, you add the Validator default error messages, custom error messages, and some general error message display information to the store error message properties files.

Procedure

  1. In the Enterprise Explorer view , expand Stores > Java Resources:src > Madisons .
  2. Double-click the storeErrorMessages_en_US.properties file to open it for editing.
  3. Observe the entry for the _ERR_CMD_INVALID_PARAM.5210 key that you referenced in the mapping for the email field in the validation.xml file.
  4. Append the Struts Validator default error messages that you can find from the introductory comment in the validator-rules.xml file
    .
    
    # Struts Validator Error Messages 
    errors.required={0} is required. 
    errors.minlength={0} can not be less than {1} characters. 
    errors.maxlength={0} can not be greater than {1} characters. 
    errors.invalid={0} is invalid. 
    errors.byte={0} must be a byte. 
    errors.short={0} must be a short. 
    errors.integer={0} must be an integer. 
    errors.long={0} must be a long. 
    errors.float={0} must be a float. 
    errors.double={0} must be a double. 
    errors.date={0} is not a date. 
    errors.range={0} is not in the range {1} through {2}. 
    errors.creditcard={0} is an invalid credit card number. 
    errors.email={0} is an invalid e-mail address. 
    
  5. Append the following snippet to define the additional error messages you referenced in the validation.xml file:
    
    # MyContactUsDisplay.jsp Validator error messages
    My_CONTACT_US_name.required=Type your name in the Name field.
    My_CONTACT_US_email.email=Type a valid e-mail address in the E-mail address field.
    My_CONTACT_US_comment.required=Type a comment in the Comment field.>
    
  6. Copy the following snippet to the bottom of the file to configure the layout of the error messages in your JSP page:
    
    # Struts error tag messages 
    errors.header=<font color="red">Validation errors:</font><ul>errors.footer=</ul>
    errors.prefix=<li>errors.suffix=</li>
    
  7. Save your changes.
  8. Copy your changes to the storeErrorMessages.properties file.