Hi all,
I'm new to Struts2 and needed some help troubleshooting an error when I try
to use @CustomValidator.
Here's my setup:
I have the validators.xml file in /WEB-INF/:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
<validators>
<validator name="numericField"
class="xxx.validators.NumberFieldValidator"/>
</validators>
And then I have a class called NumberFieldValidator:
package xxx.validators;
import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
public class NumberFieldValidator extends FieldValidatorSupport {
// code
}
Then I have the following annotation on a model class:
@CustomValidator(type = "numericField", message = "Price must be a number")
public void setLowPrice(Double lowPrice) {
this.lowPrice = lowPrice;
}
I am getting the following exception:
2008-07-11 11:22:44 INFO xwork2.validator.ActionValidatorManagerFactory -
Detected AnnotationActionValidatorManager, initializing it...
Jul 11, 2008 11:22:44 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IllegalArgumentException: There is no validator class mapped to
the name numericField
at
com.opensymphony.xwork2.validator.ValidatorFactory.lookupRegisteredValidatorType(ValidatorFactory.java:299)
Can anyone tell what I may be missing?
Thanks so much!
--
View this message in context:
http://www.nabble.com/%40CustomValidator-error-tp18407467p18407467.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]