Wednesday, June 21, 2006

Spring Validator "does not support command class" problem - and solution

If you are using Spring Validator (with XDoclet maybe) and are frustrated with an exception that looks like the following, read on. You are in luck!

Error creating bean with name 'myController' defined in ServletContext resource [/WEB-INF/action-servlet.xml]:
Initialization of bean failed; nested exception is java.lang.IllegalArgumentException:
Validator [org.springmodules.commons.validator.DefaultBeanValidator@1be2de2] does not support command class []

This happens because you have not specified any validation requirements for
If using XDoclet, the most common reason is specifying your validation tags on the getFooBar() method rather than the setFooBar() method of MyClass.

If you think you've done everything right, check the generated (or hand-edited) validation.xml file (typically deployed in the WEB-INF directory of your war file). It must contain a <form> stanza for MyClass with some fields to validate.

Nice information, I really appreciate the way you presented.Thanks for sharing..
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?