struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "balaji.m.cs" <balaji.m...@gmail.com>
Subject How to use validator frame work.
Date Tue, 01 Apr 2008 09:17:23 GMT

 i am using struts for my front end handling of data. now i wish to go for
validator framework for handling form validation given by user, I have put
the validaton.xml and validaton-rules.xml into web-inf and i hav plugged in
the plugin with className and paramnames as the xml files but when my
application startsup im getting such an exception can any one help me in
this.

thanks in advance.

my validation.xml
<?xml version="1.0" encoding="windows-1252" ?>
<form-validation>
 <formset>
   <form name="userform">
    <field 
      property="firstName"
      depends="required">
      <arg0 key="userform.firstName"/>
	   <arg1 name="minlength" key="${var:minlength}" resource="false"/>
		 <var>
		   <var-name>minlength</var-name>
		   <var-value>1</var-value>
		 </var>
    </field>
  </form>
 </formset>
</form-validation>

my validation-rules.xml

<?xml version="1.0" encoding="windows-1252" ?>
<form-validation>
 <global>
  <validator 
     name="required"
     classname="org.apache.struts.util.StrutsValidator"
     method="validateRequired"
     methodparams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionErrors,
                   javax.servlet.http.HttpServletRequest" 
     msg="errors.required"/>
     
  <validator name="minlength"
     classname="org.apache.struts.util.StrutsValidator"
     method="validateMinLength"
     methodparams="java.lang.Object,
                   org.apache.commons.validator.ValidatorAction,
                   org.apache.commons.validator.Field,
                   org.apache.struts.action.ActionErrors,
                   javax.servlet.http.HttpServletRequest"
     depends="required"
     msg="errors.minlength"/>
 </global>
</form-validation>


 



INFO: Loading validation rules file from '/WEB-INF/validation.xml'
Apr 1, 2008 2:38:53 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.NoSuchMethodException: No such accessible method: addArg0() on
object: org.apache.commons.validator.Field
	at
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:250)
	at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
	at org.apache.commons.digester.Rule.end(Rule.java:276)
	at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
	at
oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1287)
	at
oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:328)
	at
oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295)
	at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201)
	at org.apache.commons.digester.Digester.parse(Digester.java:1568)
	at
org.apache.commons.validator.ValidatorResourcesInitializer.initialize(ValidatorResourcesInitializer.java:259)
	at
org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:222)
	at
org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:161)
	at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
	at javax.servlet.GenericServlet.init(GenericServlet.java:257)
	at
com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2231)
	at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4617)
	at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4541)
	at
com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4730)
	at
com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1019)
	at
com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:649)
	at
com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:428)
	at com.evermind.server.Application.getHttpApplication(Application.java:512)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1975)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1958)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1910)
	at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:427)
	at
com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:395)
	at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:437)
	at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
	at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
	at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
	at java.lang.Thread.run(Thread.java:595)
Apr 1, 2008 2:38:53 PM
org.apache.commons.validator.ValidatorResourcesInitializer initialize
SEVERE: Error at (8, 39: No such accessible method: addArg0() on object:
org.apache.commons.validator.Field
java.lang.NoSuchMethodException: No such accessible method: addArg0() on
object: org.apache.commons.validator.Field
	at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
	at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
	at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
	at
oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1287)
	at
oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:328)
	at
oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295)
	at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201)
	at org.apache.commons.digester.Digester.parse(Digester.java:1568)
	at
org.apache.commons.validator.ValidatorResourcesInitializer.initialize(ValidatorResourcesInitializer.java:259)
	at
org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:222)
	at
org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:161)
	at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
	at javax.servlet.GenericServlet.init(GenericServlet.java:257)
	at
com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2231)
	at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4617)
	at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4541)
	at
com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4730)
	at
com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1019)
	at
com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:649)
	at
com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:428)
	at com.evermind.server.Application.getHttpApplication(Application.java:512)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1975)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1958)
	at
com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.getHttpApplication(HttpSite.java:1910)
	at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:427)
	at
com.evermind.server.http.HttpRequestHandler.resolveApplication(HttpRequestHandler.java:395)
	at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:437)
	at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
	at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
	at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
	at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
	at java.lang.Thread.run(Thread.java:595)

-- 
View this message in context: http://www.nabble.com/How-to-use-validator-frame-work.-tp16416912p16416912.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message