Hi,
In my form, I ve 2 date fields which I define a "From" date and a "To" date.
When the user give a "From" date greater than the "To" date, I would like to throw an error.
So in my validator, I have :
And in my jsp I have :Code:public void validate(Object object, Errors errors) { SomeObject so = (SomeObject ) object; Date date1 = so .getDateBegin(); Date date2 = so .getDateEnd(); if (null != date1 && null != date2 && date1.getTime() > date2.getTime()) { errors.reject("wrong dates", "The From date can not be greater than the To date"); } }
In my JSP, I take the first globalError (there could be only one), but I ve seen in the API that I can only display the default message with the method "getDefaultMessage" (the one defined in the validator) and not the one defined in the ResourceBundleMessageSource with the code "wrong dates".Code:<spring:hasBindErrors name="command"> <c:out value="${errors.globalError.defaultMessage}" /> </spring:hasBindErrors>
Is there a way to display the message defined in the ResourceBundleMessageSource ?
bye


Reply With Quote
