在我们用struts来进行表单验证时,也许是会出现以下异常!
org.apache.struts.validator.ValidatorForm validate
严重: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:627)
at org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:557)
at org.apache.commons.validator.Field.validateForRule(Field.java:827)
at org.apache.commons.validator.Field.validate(Field.java:906)
at org.apache.commons.validator.Form.validate(Form.java:174)
at org.apache.commons.validator.Validator.validate(Validator.java:367)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:110)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:928)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
主要原因是如果使用IDE是Myeclipse的话,它会默认自动添加.JAR和.TLD文件,自然会添加struts.jar文件,当如果在进行表单规则验证时,也许会引用validator-rules.xml文件,然后自己再编写validation.xml文件.然而在引入validator.xml文件时会造成版本的不一致性,会导致相应此种的异常! 首先,咱们先看看两个不同时间的validator-rules.xml文件!他们的dtd文档版本全是1_1_3 (1) $Id: validator-rules.xml 159291 2005-03-28 20:19:29Z niallp $
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.required"/>(2) $Id: validator-rules.xml 54932 2004-10-16 17:02:16Z germuska $ <validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest"
msg="errors.required"/>
大家可以看到,用红颜色标注出来的就是新版本中新添加的东西,如果使用老版本的validator-rules.xml文件与新版本的struts会造成org.apache.commons.validator.ValidatorException异常!
分享到:
相关推荐
org.apache.commons.lang.BitField.class org.apache.commons.lang.BooleanUtils.class org.apache.commons.lang.CharEncoding.class org.apache.commons.lang.CharRange.class org.apache.commons.lang.CharSet...
org.apache.commons.lang.BitField.class org.apache.commons.lang.BooleanUtils.class org.apache.commons.lang.CharEncoding.class org.apache.commons.lang.CharRange.class org.apache.commons.lang.CharSet...
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods....
jar包分享,你懂的 com.springsource.org.apache.commons.io-1.4.0.jar
Apache Commons Math 3.6.1 是一个由Apache软件基金会开发的开源库,它提供了广泛的数学和统计功能,适用于各种编程任务。这个版本是3.6.1,意味着它是对之前版本的改进和增强,可能包括错误修复、性能优化以及新...
com.springsource.org.apache.commons.logging-1.1.1.jar
总之,要解决`java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource`的问题,你需要确保你的项目正确包含了Apache Commons DBCP及其相关依赖,并正确配置了`BasicDataSource`。同时,了解...
解决Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils 类似错误,需要导入jar包,下载地址是http://commons.apache.org/proper/commons-io/download_io.cgi
本站为大家提供了org.apache.commons的jar包下载地址,Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动,需要此类JAR包的朋友们欢迎前来下载使用。 基本简介 commons包,根据...
总的来说,理解并解决"java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource"这一异常,不仅需要对Struts框架有一定了解,还需要掌握Java类加载机制以及数据库连接池的基本原理。通过正确...
jar包,官方版本,自测可用
"org.apache.commons jar" 指的是这个项目中相关组件的集合,通常包含多个模块,每个模块专注于特定的编程任务。 1. **Apache Commons Lang**: 这个模块提供了许多高级字符串处理、日期和时间操作、数学计算以及...
commons-validator-1.3.0.jar commons-pool-1.3.jar commons-net-3.0.jar commons-logging-api-1.1.jar commons-logging-1.0.4.jar commons-lang-2.1.jar commons-io-1.3.2.jar commons-httpclient-3.0.jar commons-...
`org.apache.commons.io`是这个库的核心包,包含了许多与文件、流、过滤器、读写操作相关的类和工具。 1. **文件操作**: `FileUtils` 类提供了大量的静态方法,用于执行文件和目录的操作,如复制、移动、删除、创建...
spring mvc 上传需要的jar包 com.springsource.org.apache.commons.fileupload-1.2.0.jar com.springsource.org.apache.commons.io-1.4.0.jar
com.springsource.org.apache.commons.fileupload 自己打入本地Jar包即可
org.apache.poi:poi:4.1.2 org.apache.poi:poi-ooxml:4.1.2 org.apache.poi:poi-ooxml-schemas:4.1.2 org.apache.xmlbeans:xmlbeans:3.1.0 ...commons-codec:commons-codec:...org.apache.commons:commons-compress:1.19
com.springsource.org.apache.commons.logging-sources-1.1.1.jar