You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2003/04/09 18:02:09 UTC
RE: Custom validation method returns false but doesn't cause an e rror
Gareth wrote:
> I haven't actually tried to write a custin validator before but I think
> struts checks the ActionErrors object to see if its empty or null, to
> ascertain if an error has happened. I think the return value just gets
> ignored.
Sure enough...
RequestProcessor.java:
// Call the form bean's validation method
if (log.isDebugEnabled()) {
log.debug(" Validating input form properties");
}
ActionErrors errors = form.validate(mapping, request);
if ((errors == null) || errors.isEmpty()) {
if (log.isTraceEnabled()) {
log.trace(" No errors detected, accepting input");
}
return (true);
}
I found an example here:
http://www.onjava.com/pub/a/onjava/2002/12/11/jakartastruts.html?page=last
It's also out of date, it uses ValidatorUtil rather than Resources.
Thanks for the tip, it's working now!
--
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management