On Sun, 20 Jan 2002, David Winterfeldt wrote:

> Date: Sun, 20 Jan 2002 00:43:36 -0800 (PST)
> From: David Winterfeldt <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Validator integration in Struts
>
> I think this got lost in the DynaBean discussion so
> I'm resending it.
>

You wouldn't think you can lose messages in an electronic mailbox, but
that's actually what happened :-(.

> --- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> <snip>
> > We should also consider whether it makes sense to
> > integrate the
> > configuration of the validation criteria into
> > struts-config.xml -- not as
> > a *replacement* for the existing mechanism, but as
> > an alternative for
> > Struts based users.
> <snip>
>
> Did you have anything specific in mind for the
> structure?  I think that this has been mentioned
> before, but I wasn't sure how to cleanly include this
> in with the struts-config.xml.  The basic information
> could be add to the form-bean definitions, but how
> would multiple locale validation rules be handled?
> Would there be multiple form-beans that defined the
> locale?
>
> <form-bean name="logonForm"
> type="org.apache.struts.action.DynaActionForm">
>    <form-property
>       name="username"
>       type="java.lang.String"
>       initial="user"
>       depends="required">
>        <arg0 key="user.displayname"/>
>    </form-property>
>    <form-property
>       name="password"
>       type="java.lang.String">
>       depends="required"/>
>        <arg0 key="password.displayname"/>
>    </form-property>
> </form-bean>
>

This is very much along the lines I was thinking.

> Also since the Validator is in Commons now, something
> like this would require maintaining a separate
> resource initializer to handle the different xml
> structure.  Which might be worthwhile to maintain if
> it would enhance usability enough.  If the current
> Validator xml structure was just placed as is in the
> struts-config.xml, then the main resource intializer
> could be made to take a parameter for the xml root to
> use (instead of /form-validation to use
> /struts-config/form-validation in
> ${xml.root}/formset/form/field).
>

Wouldn't that still require you to declare each form bean twice -- once in
the <form-beans> section and once in the <form-validation> section?

I don't see a terrible difficulty in maintaining two mechanisms for
configuration -- the existing one (so you can use validation separately
from Struts) and a customized one for Struts.  It should only be a set
of Digester rules that differ, right?

> Martin had mentioned in Commons whether or not to move
> the Struts Validator interface out of commons and into
> Struts proper.  Any thoughts on this?  It was on the
> original 1.1 to do list to have a validation framework
> built in.  I could go either way, but I think it would
> be nice if it was in the core.  Especially since there
> are so few classes left since most are in the Commons
> now (6 classes plus one or two to be added for a
> ValidatorDynaActionForm).
>

I'd like us to include it from Commons "by reference", the way we are with
beanutils, collections, dbcp, digester, logging, pool, and (soon, if we do
the same with it) services.  The Struts-specific integration would happen
within the Struts core (like I did with DynaActionForm), but the
functional classes would be the standard ones in Commons.  Does that make
sense?

> David
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to