Hi I am trying to use commons-validator framework for validation in Spring MVC. i am getting following exception.
java.lang.IllegalArgumentException: Validator [org.springmodules.commons.validator.DefaultBeanValidator@1d5b945] does not support command class [com.training.springmvc.Details]
I have attached code in zip file. Could you please help me to resolve the issue.
I would start with using the annotation based controllers which is the accepted way do controllers since Spring 2.5. There should not be a need to extend SimpleFormController. If you are using newer versions of Spring they have full support for the JSR303 Bean validation API. You can use these and just add hibernate-validator to your classpath.
The name of your command class must match the "name" attribute in yourform definition in validation.xml. If this is unacceptable you can look at using ConfigurableBeanValidator instead of DefaultBeanValidator.
You are right , i was assuming , in the below code i have set "user" as form name what being used in jsp to read from request scope. Usually in struts we assume this is the name that we have to use in validation.xml. Hmm but in spring it is different.