struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phase Web and Multimedia" <m...@phase.ws>
Subject Why not an Action Based Validator?
Date Wed, 15 Jan 2003 06:00:56 GMT
Why don't we have an action based validator or at least allow for the
validation to be either Action based or ActionForm based?

I like to keep my code clean and especially when it comes to repopulating
collections for a jsp form it seems like there are a bunch of solutions that
are non-standard and questionably effective at best. I was just thinking
that it doesn't really matter where the validation is performed. Because, if
you are preparing data that needs to be passed from the action into the
business logic layer then wouldn't the Action be an appropriate place to
allow validation. Validator is a great tools for common validation. I was
just wondering why we don't have a validate method in the base Action class
that does the same thing as the ActionForm. For example, before the execute
method is called by the ActionServlet it would call validate in the Action.
Isn't that essentially what is happening now with the validate method in the
form? Before execute is called in the Action the validate is called in the
ActionForm.

I bring this up simply because there are times when validation may fail and
we must return to a jsp page that requires prepopulated collections. Of
course if those collecitons aren't there then the page breaks. I prefer not
to be accessing my logic layers from within my ActionForm.validate metthod.
But, the Action is a tidy place to keep such code so that it is easier to
find. It seems to me that the validate method could easily be allowed in the
Action too using the Validators automatic validation techniques.

Right?

DISCLAIMER: I know that I CAN create custom validations in my Action. I am
just wondering why it doesn't call a validate method automagically :-D

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws



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


Mime
View raw message