|
From: Matt R. <li...@ra...> - 2004-04-30 10:23:21
|
I have two apps - one is based on Servlet 2.4 and one on 2.3. From what
I can tell, all the configuration is the same for commons validator.
I'm certain that the JARs are the same on both projects. Now I'm having
a really strange problem. On the 2.4 project (done with an XSD in
web.xml), the messages resolve fine, so if lastName is required, I get
"Last Name is a required field." If I try the same thing on the 2.3
project, I get "{0} is a required field." Everything looks right for
JSTL and all my other messages are getting resolved - except for
messages from the validation engine. I've pasted my relevant config
below. I tried manipulating the 2.3/2.4 thing too - that didn't help.
Another difference b/w the 2 projects is one uses
org.springframework.web.servlet.view.JstlView and the 2nd (non-working)
one uses TilesJstlView.
I'm using the latest stuff from CVS.
Thanks,
Matt
<bean id="userFormController"
class="org.appfuse.webapp.action.UserFormController">
...
<property name="validator"><ref
bean="beanValidator"/></property>
...
</bean>
<!-- This file is really named ApplicationResources_en.properties to
JSTL will pick
it up as the default. I know it doesn't sound right, but it
works. I tried
renaming w/o the extension, no dice. -->
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property
name="basename"><value>ApplicationResources</value></property>
</bean>
<bean id="validatorFactory"
class="org.springframework.validation.commons.DefaultValidatorFactory"
init-method="init">
<property name="resources">
<list>
<value>WEB-INF/validation.xml</value>
<value>WEB-INF/validator-rules.xml</value>
<value>WEB-INF/validator-rules-custom.xml</value>
</list>
</property>
</bean>
<bean id="beanValidator"
class="org.springframework.validation.commons.BeanValidator">
<property name="validatorFactory"><ref
local="validatorFactory"/></property>
</bean>
|