Back Forum Reply New

How to integrate the commons validator into spring

mons.validator.DefaultBeanVal idator@1909385] does not support command class [org.app.command.xxx]

help me regarding this.

can anyone have sample application it will be better to understand

regards
karthi

Can you paste your code here for us to analyse?

gt; can anyone have sample application it will be better to understand

Take a look here: s...ation-commons/

Cheers,

Sergio B.

mons.Fi  eldChecksquot; method=quot;validateRequiredquot;
methodParams=quot;java.lang.Object,org.apache.commons.  validator.ValidatorAction,org.apache.commons.valid  ator.Field,org..validation.Errorsquot;
msg=quot;errors.requiredquot;gt;

lt;javascriptgt;
lt;![CDATA[      ]]gt;
lt;/javascriptgt;
lt;/validatorgt;

lt;validator name=quot;requiredifquot; classname=quot;org.springmodules.validation.commons.Fi  eldChecksquot; method=quot;validateRequiredIfquot;
methodParams=quot;java.lang.Object,org.apache.commons.  validator.ValidatorAction,org.apache.commons.valid  ator.Field,org..validation.Errors,o  rg.apache.commons.validator.Validatorquot;
msg=quot;errors.requiredquot;gt;
lt;/validatorgt;

lt;/globalgt;lt;/form-validationgt;
this is the validation.xml file

lt;?xml version=quot;1.0quot; encoding=quot;iso-8859-1quot;?gt;
lt;!DOCTYPE form-validation PUBLIC         quot;-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//ENquot;         quot;commons/dtds/validator_1_1_3.dtdquot;gt;
lt;form-validationgt;
lt;formsetgt;
lt;form name=quot;loginCommandquot;gt;
lt;field property=quot;userIdquot; depends=quot;requiredquot;gt;
lt;arg0 key=quot;error.userIdquot; /gt;
lt;/fieldgt;
lt;field property=quot;passwordquot; depends=quot;requiredquot;gt;
lt;arg0 key=quot;error.passwordquot; /gt;
lt;/fieldgt;
lt;/formgt;
lt;/formsetgt;
lt;/form-validationgt;
i just integrated successfully.

with the springapp-servlet.xmllt;bean id=quot;validatorFactoryquot; class=quot;org.springmodules.validation.commons.Defaul  tValidatorFactoryquot;gt;
lt;property name=quot;validationConfigLocationsquot;gt;
lt;listgt;
lt;valuegt;/WEB-INF/validator-rules.xmllt;/valuegt;
lt;valuegt;/WEB-INF/validation.xmllt;/valuegt;
lt;/listgt;
lt;/propertygt;
lt;/beangt;

lt;bean id=quot;beanValidatorquot; class=quot;org.springmodules.validation.commons.Defaul  tBeanValidatorquot;gt;
lt;property name=quot;validatorFactoryquot; ref=quot;validatorFactoryquot; /gt;
lt;/beangt;

Here prob is, it is working fine.
but i need to get back the messages from the resource bundle to the jsp jsp page

can any one help me.
Thanx in advance

hi this is i'm using in the jsp page

lt;spring:hasBindErrors name=quot;loginCommandquot;gt;    lt;spring:bind path=quot;loginCommand.userIdquot;gt;    lt;trgt;lt;tdgt;lt;font color=quot;redquot;gt;lt;cut value=quot;${status.errorMessage}quot;/gt;lt;/fontgt;lt;/tdgt;lt;/trgt;    lt;/spring:bindgt;  lt;spring:bind path=quot;loginCommand.passwordquot;gt;      lt;c:forEach var=quot;errorquot; items=quot;${status.errorMessages}quot;gt;        lt;trgt;lt;tdgt;lt;font color=quot;redquot;gt;lt;cut value=quot;${status.errorMessage}quot;/gt;lt;/fontgt;lt;/tdgt;lt;/trgt;      lt;/c:forEachgt;    lt;/spring:bindgt;
lt;/spring:hasBindErrorsgt;

i'm getting the validation working

errors.required  errors.required

instead of this i need the messages from the resource  bundle
¥
Back Forum Reply New