Hello,
I just began learning and using Spring and this is my first post to the forums.
In the Validator class, I have registered a global error:
In the errors.properties file, I have an entry for the above error code:Code:errors.reject("error.required.fields.blank", new Object[]{new String("My Arguments")}, "Required fields cannot be blank");
In the JSP, I am trying to display the error message using:Code:error.required.fields.blank=Required Field(s) {0} cannot be blank
But the error message is displayed asCode:<spring:hasBindErrors name="user"> <c:forEach items="${errors.allErrors}" var="err"> <spring:message code="${err.code}" text="${err.defaultMessage}"/><br> </c:forEach> </spring:hasBindErrors>I would like the arguments in the error message to be substituted by the values I provide in the Validator class.Required Field(s) {0} cannot be blank
If I tie the same error message to a form field using error.rejectValue() and display it using <form:errors> tag in the JSP, it gets displayed fine.
Any help is appreciated.
Thanks,
Anand


Reply With Quote