On Sat, 30 Mar 2002, David Winterfeldt wrote:

> Date: Sat, 30 Mar 2002 11:44:43 -0800 (PST)
> From: David Winterfeldt <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: PlugIn (Craig)
>
> It looks like when you made changes to the PlugIn
> Craig that it broke the ValidatorPlugIn.  Having
> multiple set-property elements under the plug-in used
> to work, but now it looks like only the last one is
> being kept.  It looks like the addition of
> PlugInSetPropertyRule in ConfigRuleSet broke this.
> You probably know the digester better than I do if
> this could be changed.  Or point me in the right
> direction if you don't have time to do this.
>
> <plug-in
> className="org.apache.struts.validator.ValidatorPlugIn">
>    <set-property property="pathname"
> value="/WEB-INF/validator-rules.xml"/>
>    <set-property property="pathname"
> value="/WEB-INF/validation.xml"/>
> </plug-in>
>

The change to the PlugIn configuration did indeed change this, but I'm not
so sure it's a "bad thing" that needs to be fixed.

The basic issue is that PlugInConfig maintains a simple name-value Map for
the configured properties, which is then returned via getProperties() and
then used as an argument to BeanUtils.populate() to configure the
instantiated PlugIn object.  So, supporting your syntax above would
require either an API modification, or a change to the contract about what
PlugInConfig.getProperties() returns.

My discomfort with going ahead and doing this is based on the fact that it
is somewhat counterintuitive to expect a JavaBean property setter for a
scalar String property to accept and use multiple values when called
mulitple times -- the user of such a bean is going to expect replacement
semantics in this scenario.  It would also not be possible to implement
configuration of this if we extended the DTD to include a specific PlugIn
(and could therefore use attributes instead of nested <set-property/>
elements), because XML doesn't allow multiple attributes with the same
name.

Wouldn't it be better to use a comma-delimited list (or something like
that) so you can set this with one setPathname() method?

> David
>

Craig


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

Reply via email to