Announcement Announcement Module
Collapse
No announcement yet.
Validation setting error arguments Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation setting error arguments

    Just wondering if this is the proper way to set error arguments.

    Validator code snipper
    Code:
    int minAge=18;
    errors.rejectValue("age", 
                  "feedback.error.age.invalidFormat", 
                  new String[] { String.valueOf(minAge) }, 
                  "Invalid age format");

    message.properties
    Code:
    feedback.error.age.value=Age cannot be less than {0}
    form.jsp
    Code:
    <spring:bind path="feedBackForm.age">	
    <fmt:message key="feedback.age.label"/>: <input type="text" name="age"/>
    <font color="red">${status.errorMessage}</font>
    </spring:bind>
    Expected Result
    Code:
    Age: 15	  	Age cannot be less than 12
    Actual Result
    Code:
    Age: 15   	Age cannot be less than {0}
    Looks like the error parameter is not pass into {0}

    Please help.
    Coffeejoy
Working...
X