Hi everyone,
I've tried to implement a validation service to my project. My Validator Code looks like this:
I have an message xml witht he following entrys:Code:public class UserValidator implements Validator{ public boolean supports(Class<?> clazz) { return Ort.class.isAssignableFrom(clazz); } public void validate(Object target, Errors errors) { Ort ort = (Ort) target; if((ort.getcountryname().length() == 0) && (ort.getzip().length() == 0)) { errors.reject("error.zip"); errors.reject("error.countryname"); } } }
Everythink works fine. I make an outprint on my jsp like this:Code:...... error.zip=There is an Error at Zip-Code error.countryname=There is an Error at Countryname
My HTML Code looks like this if i get an error:Code:<form:errors path="*" cssClass="error message" element="div"/>
My Question:Code:There is an Error at Zip-Code<br>There is an Error at Countryname
How can I join the message so that i get an outprint on my jsp with looks so:
Can i do somethink like that in my validation class?:Code:There is an Error at Zip-Code, There is an Error at Countryname
Thanks for your helpCode:...... errors.reject("error.zip"+"error.countryname"); ......
Regards
Crazymodder



Reply With Quote
