Somehow I don't get my commons validator to work after I changed my command class.
I get following error message:
validation.xml:Code:java.lang.IllegalArgumentException: Validator [org.springframework.validation.commons.BeanValidator@1ba5016] does not support command class [example.web.commandObj.UserFormCommand]
action-servlet.xml:Code:<form-validation> <formset> <form name="user"> <field property="username" depends="required"> <arg0 key="user.user.username"/> </field> </form> </formset> </form-validation>
Code:<bean id="userFormController" class="example.web.UserFormController"> <!-- optional - if you don't define it then the default name is command --> <property name="commandName"> <value>user</value> </property> <property name="commandClass"> <value>example.web.commandObj.UserFormCommand</value> </property> <property name="formView"> <value>userForm</value> </property> <property name="successView"> <value>showUser.html</value> </property> <property name="userManager"> <ref bean="userManager"/> </property> <property name="validator"> <ref bean="beanValidator"/> </property> </bean>
the jsp file:
I already found a similar problem in the forum but I still haven't figured out what the problem isCode:<form name="user" method="post" action="<c:url value="/showAddUser.html"/>" onsubmit="return validateUser(this)"> <table> <tr> <th> <fmt:message key="user.username"/>: </th> <td> <spring:bind path="user.user.username"> <input type="text" name="${status.expression}" value="<c:out value="${status.value}"/>"> <span class="fieldError">${status.errorMessage}</span> </spring:bind> </td> [...]


Reply With Quote