You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Muller <mm...@theworld.com> on 2003/07/03 08:42:28 UTC

validation doesn't validate

I can't get the validation framework to do anything. 

I'm speculating that the validation.xml file isn't being read; I tried 
putting a rule that doesn't exist and then some arbitrary syntactically 
incorrect text in the file, and I didn't get an error anywhere I could 
find.  On the other hand, there is a message like this:

INFO: Loading validation rules file from '/WEB-INF/validation.xml'

in the console log.  And no errors.  No errors in the localhost_log, 
either.  So maybe it *is* reading the validation file.

My form bean name matches my validation form name, which matches the 
name in my action mapping.  I have validate=true in my action mapping.  
I have a validation rule defined for a field on the form.  (Two, 
actually: required and integer.)  Nothing. 

I'm using a DynaValidatorActionForm, in case that matters.  Oh, and this 
is RC1 of 1.1 running in tomcat 4.1.

Help!  I'm sure this is a common problem, and I'll be embarassed when I 
learn what it is, but I'm stuck.

Thanks,

  -- Mike




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


Re: validation doesn't validate

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Sounds like you made the same mistake as me, not reading the Javadoc for 
DynaValidatorActionForm properly. To use this you specify the action 
mapping PATH in the validation xml form tag, not the name. If you want 
to specify validation against your form-bean names, then use 
DynaValidationForm, not DynaValidationACTIONForm.

hth
Adam

Michael Muller wrote:
> 
> I can't get the validation framework to do anything.
> I'm speculating that the validation.xml file isn't being read; I tried 
> putting a rule that doesn't exist and then some arbitrary syntactically 
> incorrect text in the file, and I didn't get an error anywhere I could 
> find.  On the other hand, there is a message like this:
> 
> INFO: Loading validation rules file from '/WEB-INF/validation.xml'
> 
> in the console log.  And no errors.  No errors in the localhost_log, 
> either.  So maybe it *is* reading the validation file.
> 
> My form bean name matches my validation form name, which matches the 
> name in my action mapping.  I have validate=true in my action mapping.  
> I have a validation rule defined for a field on the form.  (Two, 
> actually: required and integer.)  Nothing.
> I'm using a DynaValidatorActionForm, in case that matters.  Oh, and this 
> is RC1 of 1.1 running in tomcat 4.1.
> 
> Help!  I'm sure this is a common problem, and I'll be embarassed when I 
> learn what it is, but I'm stuck.
> 
> Thanks,
> 
>  -- Mike
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: validation doesn't validate

Posted by Michael Muller <mm...@theworld.com>.
OK, so I switched to the DynaValidatorForm.  Still no joy.  There is 
something I can't explain, though.  I stuck this in my action code:

DynaValidatorForm  f  = (DynaValidatorForm)form;
System.out.println("??????????" + f.getClass().getName());

And it prints out "org.apache.struts.validator.DynaValidatorActionForm".

I double-checked my form-bean in my struts-config, and I definitely have 
  the DynaValidatorForm in there.  I reloaded the app.  It still says 
DynaValidatorActionForm.  I tried stopping tomcat and restarting it.  I 
tried changing the form bean to some bogus class, and it exploded when I 
  loaded that page (as I expected).  I changed the class back to 
DynaValidatorForm, but STILL the action says it's being passes a 
DynaValidatorActionForm.

Thanks,

Mike


David Graham wrote:

> --- Michael Muller <mm...@theworld.com> wrote:
> 
>>I can't get the validation framework to do anything. 
>>
>>I'm speculating that the validation.xml file isn't being read; I tried 
>>putting a rule that doesn't exist and then some arbitrary syntactically 
>>incorrect text in the file, and I didn't get an error anywhere I could 
>>find.  On the other hand, there is a message like this:
> 
> 
> Currently, commons-validator doesn't validate your xml file against the
> DTD so you won't see a syntax error.
> 
> 
>>INFO: Loading validation rules file from '/WEB-INF/validation.xml'
>>
>>in the console log.  And no errors.  No errors in the localhost_log, 
>>either.  So maybe it *is* reading the validation file.
>>
>>My form bean name matches my validation form name, which matches the 
>>name in my action mapping.  I have validate=true in my action mapping.  
>>I have a validation rule defined for a field on the form.  (Two, 
>>actually: required and integer.)  Nothing. 
>>
>>I'm using a DynaValidatorActionForm, in case that matters.  
> 
> 
> You need to use DynaValidatorForm.
> 
> David
> 
> 
>>Oh, and this
>>
>>is RC1 of 1.1 running in tomcat 4.1.
>>
>>Help!  I'm sure this is a common problem, and I'll be embarassed when I 
>>learn what it is, but I'm stuck.
>>
>>Thanks,
>>
>>  -- Mike
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> 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: validation doesn't validate

Posted by David Graham <gr...@yahoo.com>.
--- Michael Muller <mm...@theworld.com> wrote:
> 
> I can't get the validation framework to do anything. 
> 
> I'm speculating that the validation.xml file isn't being read; I tried 
> putting a rule that doesn't exist and then some arbitrary syntactically 
> incorrect text in the file, and I didn't get an error anywhere I could 
> find.  On the other hand, there is a message like this:

Currently, commons-validator doesn't validate your xml file against the
DTD so you won't see a syntax error.

> 
> INFO: Loading validation rules file from '/WEB-INF/validation.xml'
> 
> in the console log.  And no errors.  No errors in the localhost_log, 
> either.  So maybe it *is* reading the validation file.
> 
> My form bean name matches my validation form name, which matches the 
> name in my action mapping.  I have validate=true in my action mapping.  
> I have a validation rule defined for a field on the form.  (Two, 
> actually: required and integer.)  Nothing. 
> 
> I'm using a DynaValidatorActionForm, in case that matters.  

You need to use DynaValidatorForm.

David

> Oh, and this
> 
> is RC1 of 1.1 running in tomcat 4.1.
> 
> Help!  I'm sure this is a common problem, and I'll be embarassed when I 
> learn what it is, but I'm stuck.
> 
> Thanks,
> 
>   -- Mike
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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