struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <strut...@reumann.net>
Subject Re: Wouldn't validation be better performed by Actions rather than ActionForms?
Date Fri, 18 Mar 2005 19:16:21 GMT
Lawrie Gallardo wrote the following on 3/18/2005 12:17 PM:

> Now if this is the case, would it not be better to have the ActionForm 
> as basically a dum data holder and have the validation method in the 
> Action classes instead? The strus-config.xml file could contain all the 
> required declarative validation, transformation and mapping info, and 
> the Action class could contain any validation, transformation, and 
> mapping operations that were too complicated to be set up declaratively.

I agree totally and I call my validation from my Action classes. Example 
here (at the end) http://reumann.net/struts/articles/request_lists.jsp

(Note in that example, I call the form's validate method from my Action, 
but I only do that in the example to show that it can be done and to 
keep it simple. In practice I think it's much better to not even do the 
validation in the ActionForm's validate method - even if you are just 
invoking that method from elsewhere.)

-- 
Rick

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


Mime
View raw message