Actually, I think that's what I really wanted without knowing it :-). Struts already provides pluggable RequestProcessors for the ActionServlet, maybe it should allow pluggable Validators for ActionForms. This way, we don't mandate the use of the commons validator or anything else, we just allow different implementations.

My first thought is that there could be a Validator (or ActionFormValidator, etc.) interface with a method like:

ActionErrors validate(ActionForm form, any other needed params);

We could provide a compliant implementation class for the commons validator. Just like RequestProcessor, the validator implementation could be configured in struts-config.xml.

I think this addresses Ted's concerns of mandating the use of certain technologies because it creates a pluggable service layer.

What do you think?

David






From: "James Mitchell" <[EMAIL PROTECTED]>
Reply-To: "Struts Developers List" <[EMAIL PROTECTED]>
To: "Struts Developers List" <[EMAIL PROTECTED]>
Subject: RE: Validator Integration
Date: Fri, 25 Oct 2002 15:30:09 -0400


I have no idea on the level of effort required, but it would be nice to be
able to drop in my own Validator implementation like I can logging, jdbc or
message resources.

Your thought?



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former."
- Albert Einstein (1879-1955)




> -----Original Message-----
> From: David Graham [mailto:dgraham1980@;hotmail.com]
> Sent: Friday, October 25, 2002 2:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Validator Integration
>
>
> I'm mainly suggesting this to get some new ideas out there. I
> don't see how
> it would break backwards compatibility. As I stated earlier, if
> a developer
> doesn't use the validator or define a validation rule for a form then the
> validate() method could just return null as usual. You wouldn't have to
> override validate to maintain compatibility. Is there something else I'm
> missing?
>
> It's not necessarily a burden to extend a different class but I do think
> it's beneficial for the framework to inherently support a high class
> validation framework without the developer being exposed to extending
> special classes.
>
> David
>
>
>
>
>
>
> >From: Joe Germuska <[EMAIL PROTECTED]>
> >Reply-To: "Struts Developers List" <[EMAIL PROTECTED]>
> >To: "Struts Developers List" <[EMAIL PROTECTED]>
> >Subject: Re: Validator Integration
> >Date: Fri, 25 Oct 2002 13:16:10 -0500
> >
> >David:
> >
> >we saw recently that you and I disagree on the "core" nature of the
> >validator package. But even if 90% of Struts users decide to
> validate with
> >Validator, I don't think that's a compelling argument to change the
> >behavior of ActionForm.
> >
> >First, doing so would break backwards compatibility. Second, by tying
> >relatively complex validation into the core class, you sort of cut off
> >other possible ways to extend ActionForm. Yes, you could argue that
> >subclasses can override the validate() method and subsequently ignore
> >anything in the ActionForm class which refers to validator, but
> that's not
> >really very clean design. Keep the core classes simple and
> focused on the
> >minimal requirements for interacting with other objects, and add
> subclasses
> >whenever more specialized behavior is needed.
> >
> >Is it a great burden to extend a different class if you want to use the
> >validator framework to validate form input? I do agree that having two
> >separate subclasses which vary only in how they key to
> validation rules is
> >unnecessarily complex, but otherwise, what benefits do such a
> change bring?
> >
> >Joe
> >
> >
> >
> >At 11:42 AM -0600 2002/10/25, David Graham wrote:
> >>Thanks for the input Ted. I was only suggesting changing
> struts-config if
> >>validator was truely merged; I agree that optional components
> don't belong
> >>there. The validation rules file should be separate but I'm suggesting
> >>that the validator not be a plugin and have an entry similar to
> >>message-resources or form-beans.
> >>
> >>Now the question is whether the validator is a core component?
> >>I don't know what you all define as core but I believe this is a core
> >>aspect. How many forms have you built that didn't need
> validation of at
> >>least one required field (if no form fields are required I question the
> >>value of the form)?
> >>
> >>What are the various options for validation? I see 2 built
> into Struts:
> >>coding a form bean's validate() method and using the validator.
> What I'm
> >>suggesting is that the ActionForm.validate() method use the
> validator by
> >>default.
> >>
> >>I just don't see any need to subclass a different ActionForm
> class to use
> >>the validator when it seems that this will become the
> predominant form of
> >>validation.
> >>
> >>David
> >>
> >>
> >>
> >>
> >>
> >>>From: Ted Husted <[EMAIL PROTECTED]>
> >>>Reply-To: "Struts Developers List" <[EMAIL PROTECTED]>
> >>>To: Struts Developers List <[EMAIL PROTECTED]>
> >>>Subject: Re: Validator Integration
> >>>Date: Fri, 25 Oct 2002 13:09:10 -0400
> >>>
> >>>I've been using the Validator for going on three years now, but
> >>>I don't think I would ever want to describe it as an integal
> >>>part of Struts. Struts provides a validation hotspot, and we
> >>>provide the Validation as something people can plug into that
> >>>spot. But we want to be very clear that it is only one of many
> >>>possible solutions to validation.
> >>>
> >>>We provide direct support for the Validator as a convenience,
> >>>but IMHO, it is not part of the true Struts core. (Of course, I
> >>>don't consider the tags part of the true Struts core either =:)
> >>>
> >>>I'd also be very cold on amending the struts-config with the
> >>>specifics for any optional component, the Validator included.
> >>>Ideally, the Validation config could be shared with other
> >>>platforms (not just Struts), and should be a standalone file.
> >>>
> >>>As mentioned elsewhere, there were two classes since some
> >>>people (or maybe one person) wanted to key on the action path
> >>>rather than the action attribute. But if we were patch this to
> >>>use a switch, mores the better.
> >>>
> >>>-Ted.
> >>>
> >>>10/25/2002 10:34:52 AM, David Graham <[EMAIL PROTECTED]>
> >>>wrote:
> >>>
> >>>>It struck me the other day that the validator could be further
> >>>integrated
> >>>>into struts. I'm not sure about my ideas so I want to get
> >>>your thoughts. y
> >>>>Why should people need to subclass ValidatorActionForm instead
> >>>of ActionForm
> >>>>to use the validator? What forms have you built that didn't
> >>>need
> >>>>validation?
> >>>>
> >>>>My idea is that the ValidatorActionForm and ValidatorForm (why
> >>>are there 2?)
> >>>>behavior should be included in ActionForm and have those
> >>>classes removed. I
> >>> >think this will maintain backward compatibility because if the
> >>>developer
> >>>>hasn't defined any validation rules for a form then we could
> >>>return null
> >>>>from validate().
> >>>>
> >>>>Further, we could include validator configuration tags in
> >>>struts-config.xml
> >>>>instead of using a plugin. This would signify that validator
> >>>is an integral
> >>>>piece of struts that most people want to use (which I believe
> >>>they do).
> >>>>
> >>>>This is probably a post 1.1 idea but I thought I'd throw it
> >>>out here.
> >>>>What do you think?
> >>>>
> >>>>David
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>______________________________________________________________
> >>>___
> >>>>Unlimited Internet access -- and 2 months free! Try MSN.
> >>>>http://resourcecenter.msn.com/access/plans/2monthsfree.asp
> >>>>
> >>>>
> >>>>--
> >>>>To unsubscribe, e-mail: <mailto:struts-dev-
> >>>[EMAIL PROTECTED]>
> >>>>For additional commands, e-mail: <mailto:struts-dev-
> >>>[EMAIL PROTECTED]>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>>--
> >>>To unsubscribe, e-mail:
> >>><mailto:struts-dev-unsubscribe@;jakarta.apache.org>
> >>>For additional commands, e-mail:
> >>><mailto:struts-dev-help@;jakarta.apache.org>
> >>
> >>
> >>_________________________________________________________________
> >>Protect your PC - get McAfee.com VirusScan Online
> >>http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> >>
> >>
> >>--
> >>To unsubscribe, e-mail:
> >><mailto:struts-dev-unsubscribe@;jakarta.apache.org>
> >>For additional commands, e-mail:
> >><mailto:struts-dev-help@;jakarta.apache.org>
> >
> >
> >--
> >--
> >* Joe Germuska { [EMAIL PROTECTED] }
> >"It's pitiful, sometimes, if they've got it bad. Their eyes get glazed,
> >they go white, their hands tremble.... As I watch them I often
> feel that a
> >dope peddler is a gentleman compared with the man who sells records."
> > --Sam Goody, 1956
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:struts-dev-unsubscribe@;jakarta.apache.org>
> >For additional commands, e-mail:
> ><mailto:struts-dev-help@;jakarta.apache.org>
>
>
> _________________________________________________________________
> Surf the Web without missing calls! Get MSN Broadband.
> http://resourcecenter.msn.com/access/plans/freeactivation.asp
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>



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

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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

Reply via email to