You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ne...@srb-intl.com on 2003/04/23 19:15:25 UTC
Validator: server-side validator never called.
Hi,
Implemented validator, declared it in validator-rules.xml
and done all things in a way it is documented. JScript validation
suceeds, but server-side validator is never called.
Is there a way to discover what validators are 'known/registered/called'?
Here comes my 'digging':
into ValidatorActionForm validate() method, and found that:
Validator validator = Resources.initValidator(mapping.getPath(), ...
try {
validatorResults = validator.validate();
executes validate() without exception but never calls method declared in validator-rules.xml:
<validator name="date3"
classname="framework.util.Validator"
method="validateDate3"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest,
javax.servlet.ServletContext"
msg="errors.date3">
<javascript><![CDATA[
function validateDate3(form) { ...
and my validator implementation looks trivial:
package framework.util;
public final class Validator implements java.io.Serializable
{
private static final Logging log = new Logging(Validator.class);
// no instances of this class:
private Validator() {}
public static boolean validateDate3(Object bean,
ValidatorAction va,
Field field,
ActionErrors errors,
HttpServletRequest request,
ServletContext application)
{
System.out.println('validateDate3');
return true;
}
}
~nn
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Validator: server-side validator never called.
Posted by Jeff Kyser <kt...@comcast.net>.
Where did you find the validate() signature that includes
ServletContext?
[ I may be out of date, but if I am, I'm staying that way :) ]
I don't have that as an argument to any of my custom validators,
nor do I see it in the validator-rules.xml file that comes with struts.
other than that, I dunno
-jeff
On Wednesday, April 23, 2003, at 12:15 PM,
Nerijus.Navickas@srb-intl.com wrote:
> Hi,
>
> Implemented validator, declared it in validator-rules.xml
> and done all things in a way it is documented. JScript validation
> suceeds, but server-side validator is never called.
>
> Is there a way to discover what validators are
> 'known/registered/called'?
>
>
>
> Here comes my 'digging':
>
> into ValidatorActionForm validate() method, and found that:
>
> Validator validator =
> Resources.initValidator(mapping.getPath(), ...
> try {
> validatorResults = validator.validate();
>
>
> executes validate() without exception but never calls method declared
> in validator-rules.xml:
>
> <validator name="date3"
> classname="framework.util.Validator"
> method="validateDate3"
> methodParams="java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionErrors,
> javax.servlet.http.HttpServletRequest,
> javax.servlet.ServletContext"
> msg="errors.date3">
>
> <javascript><![CDATA[
> function validateDate3(form) { ...
>
>
> and my validator implementation looks trivial:
>
> package framework.util;
> public final class Validator implements java.io.Serializable
> {
> private static final Logging log = new Logging(Validator.class);
>
> // no instances of this class:
> private Validator() {}
>
> public static boolean validateDate3(Object bean,
> ValidatorAction va,
> Field field,
> ActionErrors errors,
> HttpServletRequest request,
> ServletContext application)
> {
> System.out.println('validateDate3');
> return true;
> }
> }
>
> ~nn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Validator: server-side validator never called.
Posted by Jeff Kyser <kt...@comcast.net>.
On my system (I use resin), when I restart resin, all the validator
rules that are loaded are written to the stdout file. I've got log4j
enabled,
so that may contribute to getting all the output, but I can see my
custom validators being loaded that way.
Although I don't see it in your e-mail below, I'm assuming
that somewhere, in your validation.xml file, you've got a:
depends='date3'
declared for the desired form element?
-jeff
On Wednesday, April 23, 2003, at 12:15 PM,
Nerijus.Navickas@srb-intl.com wrote:
> Hi,
>
> Implemented validator, declared it in validator-rules.xml
> and done all things in a way it is documented. JScript validation
> suceeds, but server-side validator is never called.
>
> Is there a way to discover what validators are
> 'known/registered/called'?
>
>
>
> Here comes my 'digging':
>
> into ValidatorActionForm validate() method, and found that:
>
> Validator validator =
> Resources.initValidator(mapping.getPath(), ...
> try {
> validatorResults = validator.validate();
>
>
> executes validate() without exception but never calls method declared
> in validator-rules.xml:
>
> <validator name="date3"
> classname="framework.util.Validator"
> method="validateDate3"
> methodParams="java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionErrors,
> javax.servlet.http.HttpServletRequest,
> javax.servlet.ServletContext"
> msg="errors.date3">
>
> <javascript><![CDATA[
> function validateDate3(form) { ...
>
>
> and my validator implementation looks trivial:
>
> package framework.util;
> public final class Validator implements java.io.Serializable
> {
> private static final Logging log = new Logging(Validator.class);
>
> // no instances of this class:
> private Validator() {}
>
> public static boolean validateDate3(Object bean,
> ValidatorAction va,
> Field field,
> ActionErrors errors,
> HttpServletRequest request,
> ServletContext application)
> {
> System.out.println('validateDate3');
> return true;
> }
> }
>
> ~nn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org