|
From: Matt R. <li...@ra...> - 2004-04-27 16:23:09
|
Doh - spoke to soon. It seems like the following is failing in the
JavaScriptValidatorTag:
private ValidatorResources getValidatorResources() {
ListableBeanFactory lbf =3D WebApplicationContextUtils
=20
.getRequiredWebApplicationContext(pageContext.getServletContext());
ValidatorFactory factory =3D (ValidatorFactory)
BeanFactoryUtils
.beanOfTypeIncludingAncestors(lbf,
ValidatorFactory.class, true, true);
return factory.getValidatorResources();
}
I'm getting the following error now:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
unique bean of type
[org.springframework.validation.commons.ValidatorFactory] is defined:
Expected single bean but found 0
=09
org.springframework.beans.factory.BeanFactoryUtils.beanOfTypeIncludingAn
cestors(BeanFactoryUtils.java:147)
=09
org.springframework.validation.commons.taglib.JavascriptValidatorTag.get
ValidatorResources(JavascriptValidatorTag.java:773)
=09
org.springframework.validation.commons.taglib.JavascriptValidatorTag.doS
tartTag(JavascriptValidatorTag.java:346)
=09
org.apache.jsp.scripts.validator_jsp._jspx_meth_html_javascript_0(valida
tor_jsp.java:78)
=09
org.apache.jsp.scripts.validator_jsp._jspService(validator_jsp.java:55)
=09
Maybe my validatorFactory syntax is wrong?
<bean id=3D"validatorFactory"
class=3D"org.springframework.validation.commons.DefaultValidatorFactory" =
init-method=3D"init">
<property name=3D"resources">
<list>
=09
<value>WEB-INF/validator-rules.xml</value>
<value>WEB-INF/validation.xml</value>
</list>
</property>
</bean>
BTW, I also had to change "spring-commons-validator.tld" to *not*
require formName:
<attribute>
<name>formName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
This is how Struts does it and its necessary to make a standalone
JavaScript/JSP work.
Thanks,
Matt
> -----Original Message-----
> From: Matt Raible [mailto:li...@ra...]=20
> Sent: Tuesday, April 27, 2004 9:26 AM
> To: 'spr...@li...'
> Subject: RE: [Springframework-developer] [Commons Validator]=20
> Error on Startup
>=20
>=20
> Thanks Keith - problem fixed!
>=20
> Matt
>=20
> > -----Original Message-----
> > From: spr...@li...
> > [mailto:spr...@li...]
> > On Behalf Of Keith Donald
> > Sent: Tuesday, April 27, 2004 8:30 AM
> > To: spr...@li...
> > Subject: RE: [Springframework-developer] [Commons Validator]=20
> > Error on Startup
> >=20
> >=20
> > ValidatorFactory is now a interface - DefaultValidatorFactory
> > is the implementation. Daniel made it an interface to be a=20
> > bit more flexible for those who had custom validation-xml=20
> > loading requirements.
> >=20
> > Keith
> >=20
> > -----Original Message-----
> > From: spr...@li...
> > [mailto:spr...@li...]
> > On Behalf Of Matt Raible
> > Sent: Tuesday, April 27, 2004 2:51 AM
> > To: spr...@li...
> > Subject: [Springframework-developer] [Commons Validator]
> > Error on Startup
> >=20
> >=20
> > I grabbed a fresh checkout from CVS tonight, expecting that
> > the commons validator stuff still worked. Unfortunately,=20
> > (from what I can tell) it does not. Here's the error I get=20
> > on startup:
> >=20
> > ERROR - FrameworkServlet.initServletBean(207) | Context
> > initialization failed
> > org.springframework.beans.factory.BeanDefinitionStoreException
> > : Error registering bean with name 'va lidatorFactory'=20
> > defined in resource [/WEB-INF/action-servlet.xml] of
> > ServletContext: Validation of b
> > ean definition with name failed; nested exception is=20
> > org.springframework.beans.factory.support.BeanD
> > efinitionValidationException: No public constructor in class=20
> > [interface org.springframework.validati=20
> > on.commons.ValidatorFactory]=20
> > org.springframework.beans.factory.support.BeanDefinitionValida
> > tionExcept
> > ion: No public constructor i
> > n class [interface=20
> > org.springframework.validation.commons.ValidatorFactory]
> > at=20
> > org.springframework.beans.factory.support.RootBeanDefinition.v
> > alidate(Ro
> > otBeanDefinition.
> > java:334)
> > at=20
> > org.springframework.beans.factory.support.DefaultListableBeanF
> > actory.reg
> > isterBeanDefiniti
> > on(DefaultListableBeanFactory.java:194)
> > at=20
> > org.springframework.beans.factory.xml.DefaultXmlBeanDefinition
> > Parser.loa
> > dBeanDefinition(D
> > efaultXmlBeanDefinitionParser.java:214)
> > at=20
> > org.springframework.beans.factory.xml.DefaultXmlBeanDefinition
> > Parser.reg
> > isterBeanDefiniti
> > ons(DefaultXmlBeanDefinitionParser.java:152)
> > at=20
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.
> > registerBe
> > anDefinitions(Xml
> > BeanDefinitionReader.java:161)
> > at=20
> > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.
> > loadBeanDe
> > finitions(XmlBean
> > DefinitionReader.java:127)
> >=20
> > ----------------------------------------
> >=20
> > Here's my config:
> >=20
> > <bean id=3D"validatorFactory"
> > class=3D"org.springframework.validation.commons.ValidatorFactory"=20
> > init-method=3D"init">
> > <property name=3D"resources">
> > <list>
> > =09
> > <value>WEB-INF/validator-rules.xml</value>
> > <value>WEB-INF/validation.xml</value>
> > </list>
> > </property>
> > </bean>
> >=20
> > <bean id=3D"beanValidator"
> > class=3D"org.springframework.validation.commons.BeanValidator">
> > <property name=3D"validatorFactory"><ref=20
> > local=3D"validatorFactory"/></property>
> > </bean>
> >=20
> > Any ideas?
> >=20
> > Thanks,
> >=20
> > Matt
> >=20
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.net email is sponsored by: The Robotic Monkeys at
> > ThinkGeek For a limited time only, get FREE Ground shipping=20
> > on all orders of $35 or more. Hurry up and shop folks, this=20
> > offer expires April 30th!=20
> > http://www.thinkgeek.com/freeshipping/?cpg=3D> 12297
> >=20
> > _______________________________________________
> >=20
> > Springframework-developer mailing list
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/s>
pringframework-developer
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.net email is sponsored by: The Robotic Monkeys at
> > ThinkGeek For a limited time only, get FREE Ground shipping=20
> > on all orders of $35 or more. Hurry up and shop folks, this=20
> > offer expires April 30th!=20
> > http://www.thinkgeek.com/freeshipping/?cpg=12297
> >=20
> > _______________________________________________
> > Springframework-developer mailing list
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/s>
pringframework-developer
> >=20
>=20
|