I'd love to use this, but I'm worried about losing the lovely
"ValidatorForm" that my BaseForm extends.  Any way I can use the Validator
form with the "DynaActionForm"?

Thanks,

Matt

-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 5:33 PM
To: Struts Developers List
Subject: Re: Self-Initializing DynaBean ?




On Wed, 16 Jan 2002, Anil Mandava wrote:

> Date: Wed, 16 Jan 2002 15:27:25 -0800
> From: Anil Mandava <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: 'Struts Developers List' <[EMAIL PROTECTED]>
> Subject: Self-Initializing  DynaBean ?
>
> It would be nice to implement a DynaBean version that can self-populate
> or self-initialize the properties.
>
> Say, if it were possible to encode property type in the
> property name as: "myProp{MyPropClass}"
> then the DyanBean's getter/setter can auto add a corresponding dyna
> property.
> This will enable any sub properties of MyPropClass to be invoked properly.
>
> That is all possible, only if we extend the property specification to
> include {type} part.
> Do you feel this is a reasonable thing to do, or are there any pitfalls
here
> ?
>
> I am more interested in doing this with (Craig's soon to come)
> DynaActionForm.
> My end goal is to have one generic form bean (that will work for all
> actions).
> For such a generic form bean to handle multi-level properties
> such as "myProp{MyPropClass}.subProp", it has to infer and initialize the
> first property, so that the setter on the subProp can be invoked.
>
> I am interested in knowing your thoughts and opinions on this.
> If it does work out and I happen to implement it, I will provide a patch.
>

I just checked in the code for DynaActionForm, along with support for it
in Struts.  I also added a way to configure the initial value for dynamic
properties that is used in the reset() method.  So, you could preconfigure
the logon form's values like this:

  <form-bean name="logonForm"
type="org.apache.struts.action.DynaActionForm">
    <form-property name="username" type="java.lang.String" initial="user"/>
    <form-property name="password" type="java.lang.STring"/>
  </form-bean>

much the same as you can preinitialize normal instance variables with
initial values when the bean is created.

Does that do what you were looking for?

> Thank you all for the great work !
> Anil
>

Craig


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


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

Reply via email to