You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Don Brown <mr...@twdata.org> on 2004/05/20 21:16:43 UTC

Validator Design Questions

With the validator as a constant source of hangups, I'm working on 
becoming more familiar with how it works.  I have some questions, 
perhaps rather basic and obvious:

Why does Struts perform all its validation with o.a.s.v.CheckFields?  It 
seems it duplicates a most of commons-validator's, well, validators.  
Why not process the ValidationResults after validator.validate() to 
create the necessary ActionMessages and use commons-validator's existing 
validators?

This might more just validator specific, but why is there no facility to 
provide the validator an already existing instance of a Validator (or if 
there is, where is it)?  It seems the only options are to create a 
Validator with static methods or a no arg constructor.  I think it would 
be valuable to let Spring manage more complex validators that rely on 
business objects, and re-use those validators with Struts.  Or, perhaps 
you want a method on one of your existing business objects to be called 
for validation.

Thanks for the help,

Don

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


Re: Validator Design Questions

Posted by David Graham <gr...@yahoo.com>.
--- Joe Germuska <Jo...@Germuska.com> wrote:
> At 3:16 PM -0400 5/20/04, Don Brown wrote:
> >With the validator as a constant source of hangups, I'm working on 
> >becoming more familiar with how it works.  I have some questions, 
> >perhaps rather basic and obvious:
> >
> >Why does Struts perform all its validation with o.a.s.v.CheckFields? 
> >It seems it duplicates a most of commons-validator's, well, 
> >validators.  Why not process the ValidationResults after 
> >validator.validate() to create the necessary ActionMessages and use 
> >commons-validator's existing validators?
> 
> I suspect this is just a legacy of Validator being factored out of
> Struts.
> 
> >This might more just validator specific, but why is there no 
> >facility to provide the validator an already existing instance of a 
> >Validator (or if there is, where is it)?  It seems the only options 
> >are to create a Validator with static methods or a no arg 
> >constructor.  I think it would be valuable to let Spring manage more 
> >complex validators that rely on business objects, and re-use those 
> >validators with Struts.  Or, perhaps you want a method on one of 
> >your existing business objects to be called for validation.
> 
> I suspect this also is mostly history, although I can't claim to be 
> an expert about validator.  I know that around 1.0, I tried to work 
> my way through the code and found it very confusing.  I think it's 
> just the way it has evolved.

Rob and I have been working on cleaning up commons-validator since then. 
It's much better than it was but still has room for improvement.  One area
that has always confused me is how it passes back results in a
ValidationResults object.  It seems like that could be cleaned up a bit. 
If you're interested in validator we would very much appreciate more
contributors :-).

David

> 
> Joe




	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 

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


Re: Validator Design Questions

Posted by Joe Germuska <Jo...@Germuska.com>.
At 3:16 PM -0400 5/20/04, Don Brown wrote:
>With the validator as a constant source of hangups, I'm working on 
>becoming more familiar with how it works.  I have some questions, 
>perhaps rather basic and obvious:
>
>Why does Struts perform all its validation with o.a.s.v.CheckFields? 
>It seems it duplicates a most of commons-validator's, well, 
>validators.  Why not process the ValidationResults after 
>validator.validate() to create the necessary ActionMessages and use 
>commons-validator's existing validators?

I suspect this is just a legacy of Validator being factored out of Struts.

>This might more just validator specific, but why is there no 
>facility to provide the validator an already existing instance of a 
>Validator (or if there is, where is it)?  It seems the only options 
>are to create a Validator with static methods or a no arg 
>constructor.  I think it would be valuable to let Spring manage more 
>complex validators that rely on business objects, and re-use those 
>validators with Struts.  Or, perhaps you want a method on one of 
>your existing business objects to be called for validation.

I suspect this also is mostly history, although I can't claim to be 
an expert about validator.  I know that around 1.0, I tried to work 
my way through the code and found it very confusing.  I think it's 
just the way it has evolved.

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
       "Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining."
             -- Jef Raskin

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


Re: Validator Design Questions

Posted by Don Brown <mr...@twdata.org>.
Ok, good, then there is nothing obvious I'm missing. I think it would be 
a good goal for Struts to use validator completely and not require its 
own validators, and I will look into that. As for the loading of 
validators, yes, I'll take that over to commons-dev.

Don

David Graham wrote:

>--- Don Brown <mr...@twdata.org> wrote:
>  
>
>>With the validator as a constant source of hangups, I'm working on 
>>becoming more familiar with how it works.  I have some questions, 
>>perhaps rather basic and obvious:
>>
>>Why does Struts perform all its validation with o.a.s.v.CheckFields?  It
>>
>>seems it duplicates a most of commons-validator's, well, validators.  
>>Why not process the ValidationResults after validator.validate() to 
>>create the necessary ActionMessages and use commons-validator's existing
>>
>>validators?
>>
>>This might more just validator specific, but why is there no facility to
>>
>>provide the validator an already existing instance of a Validator (or if
>>
>>there is, where is it)?  It seems the only options are to create a 
>>Validator with static methods or a no arg constructor.  I think it would
>>
>>be valuable to let Spring manage more complex validators that rely on 
>>business objects, and re-use those validators with Struts.  Or, perhaps 
>>you want a method on one of your existing business objects to be called 
>>for validation.
>>    
>>
>
>The original design was for all validations to be loaded from an xml file
>into a ValidatorResources object that Validator objects use against
>beans/forms.  I don't think adding resources at run time was considered.
>
>The active validator team is really just Rob and me at this point so your
>input is much appreciated.  We should probably continue the discussion on
>commons-dev though.
>
>David
>
>
>  
>
>>Thanks for the help,
>>
>>Don
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>>For additional commands, e-mail: dev-help@struts.apache.org
>>
>>    
>>
>
>
>
>	
>		
>__________________________________
>Do you Yahoo!?
>Yahoo! Domains – Claim yours for only $14.70/year
>http://smallbusiness.promotions.yahoo.com/offer 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>For additional commands, e-mail: dev-help@struts.apache.org
>
>  
>


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


Re: Validator Design Questions

Posted by David Graham <gr...@yahoo.com>.
--- Don Brown <mr...@twdata.org> wrote:
> With the validator as a constant source of hangups, I'm working on 
> becoming more familiar with how it works.  I have some questions, 
> perhaps rather basic and obvious:
> 
> Why does Struts perform all its validation with o.a.s.v.CheckFields?  It
> 
> seems it duplicates a most of commons-validator's, well, validators.  
> Why not process the ValidationResults after validator.validate() to 
> create the necessary ActionMessages and use commons-validator's existing
> 
> validators?
> 
> This might more just validator specific, but why is there no facility to
> 
> provide the validator an already existing instance of a Validator (or if
> 
> there is, where is it)?  It seems the only options are to create a 
> Validator with static methods or a no arg constructor.  I think it would
> 
> be valuable to let Spring manage more complex validators that rely on 
> business objects, and re-use those validators with Struts.  Or, perhaps 
> you want a method on one of your existing business objects to be called 
> for validation.

The original design was for all validations to be loaded from an xml file
into a ValidatorResources object that Validator objects use against
beans/forms.  I don't think adding resources at run time was considered.

The active validator team is really just Rob and me at this point so your
input is much appreciated.  We should probably continue the discussion on
commons-dev though.

David


> 
> Thanks for the help,
> 
> Don
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 

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