Hi!
Im trying to integrate the commons validator. I used Matt Raible's guide (http://www.jroller.com/page/raible/2...or_with_spring) to do it - validation works but I get no error messages. Can anyone tell me what is wrong?
My action-servlet.xml:
jsp pageCode:<bean id="validatorFactory" class="org.springframework.validation.commons.DefaultValidatorFactory" init-method="init"> <property name="resources"> <list> <value>/WEB-INF/validator-rules.xml</value> <value>/WEB-INF/validation.xml</value> </list> </property> </bean> <bean id="beanValidator" class="org.springframework.validation.commons.BeanValidator"> <property name="validatorFactory"> <ref local="validatorFactory"/> </property> </bean> <bean id="userFormController" class="exsample.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>exsample.model.User</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>
Code:[...] <tr> <th> <fmt:message key="user.username"/>: </th> <td> <spring:bind path="user.username"> <input type="text" name="username" value="${user.username}"/> <span class="fieldError">${status.errorMessage}</span> </spring:bind> </td> [...] </tr>


Reply With Quote