struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: org.apache.commons.validator.ValidatorException: No such validation method:
Date Thu, 23 Nov 2006 23:48:03 GMT
When you upgrade Struts, you must also replace your validator.xml file. 
The signatures have changed between versions.

Thomas Thomas wrote:
> Hi,
> been one week I have this error ....
> 
> When I try to submit a form,
> I have this error :
> ****************************************************************************************************

> 
> 23-nov.-2006 23:38:32 org.apache.struts.validator.DynaValidatorForm 
> validate
> GRAVE: No such validation method:
> 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: No such validation method:
> 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:603)
>    at org.apache.commons.validator.ValidatorAction.executeValidationMethod(
> ValidatorAction.java:533)
>    at org.apache.commons.validator.Field.validateForRule(Field.java:766)
>    at org.apache.commons.validator.Field.validate(Field.java:846)
>    at org.apache.commons.validator.Form.validate(Form.java:290)
>    at org.apache.commons.validator.Validator.validate(Validator.java:354)
>    at org.apache.struts.validator.DynaValidatorForm.validate(
> DynaValidatorForm.java:117)
>    at org.apache.struts.chain.commands.servlet.ValidateActionForm.validate(
> ValidateActionForm.java:53)
>    at org.apache.struts.chain.commands.AbstractValidateActionForm.execute(
> AbstractValidateActionForm.java:100)
>    at org.apache.struts.chain.commands.ActionCommandBase.execute(
> ActionCommandBase.java:48)
>    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>    at org.apache.commons.chain.generic.LookupCommand.execute(
> LookupCommand.java:304)
>    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>    at org.apache.struts.chain.ComposableRequestProcessor.process(
> ComposableRequestProcessor.java:280)
>    at org.apache.struts.action.ActionServlet.process(ActionServlet.java
> :1858)
>    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
>    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:664)
>    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)
> ****************************************************************************************************

> 
> 
> This is in my struts-config.xml :
> [...]
>        <action
>            path="/Login"
>            type="controllers.submits.LoginAction"
>            name="loginForm"
>            input="menu_left.jsp"
>            validate="true"
>            scope="request">
>        </action>
> [...]
>        <form-bean name="loginForm" type="
> org.apache.struts.validator.DynaValidatorForm">
>                 <form-property name="login" type="java.lang.String" />
>                 <form-property name="password" type="java.lang.String" />
>        </form-bean>
> [....]
>     <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
>          <set-property property="pathnames"
>                         value="/WEB-INF/validators/validator-rules.xml ,
> /WEB-INF/validators/validation.xml"/>
>    </plug-in>
> [...]
> 
> Here are my validation.xml and my validator-rules.xml (located both in
> /WEB-INF/validators/) :
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!DOCTYPE form-validation PUBLIC
>     "-//Apache Software Foundation//DTD Commons Validator Rules
> Configuration 1.3.0//EN"
>     "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">
> 
> <form-validation>
>    <formset>
>        <form name="loginForm">
> 
>            <field property="login" depends="required">
>                <arg key="required.login"/>
>            </field>
>        </form>
>    </formset>
> </form-validation>
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE form-validation PUBLIC
>        "-//Apache Software Foundation//DTD Commons Validator Rules
> Configuration 1.3.0//EN"
>        "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">
> 
> <form-validation>
>  <global>
>    <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.ActionErrors,
>                     javax.servlet.http.HttpServletRequest"
>                msg="errors.required">
>      <javascript>
>        <![CDATA[
>        function validateRequired(form) {
>          var isValid = true;
>          var focusField = null;
>          var i = 0;
>          var fields = new Array();
>          oRequired = new required();
>          for (x in oRequired) {
>            var field = form[oRequired[x][0]];
> 
>            if (field.type == 'text' ||
>                field.type == 'textarea' ||
>                field.type == 'file' ||
>                field.type == 'select-one' ||
>                field.type == 'radio' ||
>                field.type == 'password') {
> 
>              var value = '';
> 
>              // get field's value
>              if (field.type == "select-one") {
>                var si = field.selectedIndex;
>                if (si >= 0) {
>                  value = field.options[si].value;
>                }
>              } else {
>                value = field.value;
>              }
> 
>              if (trim(value).length == 0) { {
>                if (i == 0) {
>                  focusField = field;
>                }
>                fields[i++] = oRequired[x][1];
>                isValid = false;
>              }
>            }
>          }
> 
>          if (fields.length > 0) {
>            focusField.focus();
>            alert(fields.join('\n'));
>          }
> 
>          return isValid;
>        }
> 
>        // Trim whitespace from left and right sides of s.
>        function trim(s) {
>          return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
>        }
> 
>        ]]>
>      </javascript>
>    </validator>
>  </global>
> </form-validation>
> 
> 
> 
> Any help would be very very welcome !
> Thank u !
> 

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


Mime
View raw message