Aside from form field definition, which isn't needed for a lazy form
bean, having a FormDef-backed form would take care of the
formatting/parsing of the data, even i18n.  The form definition &
validation config combo is actually just optional.

My understanding of the question on the user list was for a form which
contained an array of beans, instead of just an array of strings.  An
example would be a form bean containing a list/array of children, each
with a name, date of birth, daily allowance, etc.  If each child is a
dyna form, I can use FormDef for each element.

On Fri, 1 Oct 2004 22:35:15 +0100, Niall Pemberton
<[EMAIL PROTECTED]> wrote:
> I believe I understand the principle of FormDef - you're combining the form
> definition with the validation rules. So is that why you want to nest
> indexed ActionForms rather than any old type of DynaBean? Are you then
> calling the validate() method on each of the indexed ActionForms?
> 
> You're right if you want a properly initialized lazy ActionForm then you
> need to go through the FormBeanConfig's createActionForm method. Having said
> that the default "indexed" property type of LazyDynaBean/LazyValdatorForm is
> an ArrayList - changing that to a LazyDynaBean[] as I showed in the
> CustomLazyBean means there is no need to then initialize that indexed
> property - its done automatically for arrays (CustomLazyBean would
> instantiate a new DynaBean and grows it accordingly).
> 
> From reading the message on the FormDef user list, then just having a
> property which is a CustomLazyBean (rather than CustomLazyBean array) sounds
> like it would work for your user - then only thing then is I don't really
> understand how that then interacts with FormDef - hence my questions at the
> top.
> 
> Sorry, should have got round to giving FormDef a go - but lifes busy :-(
> 
> Niall
> 
> 
> 
> ----- Original Message -----
> From: "Hubert Rabago" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, October 01, 2004 9:43 PM
> Subject: Re: Indexed Properties and Lazy List behaviour
> 
> > But if I need it to be a DynaActionForm subclass, then I'd just use
> > LazyValidatorForm or its subclass, right?  In which case, wouldn't I
> > have to worry about it being properly initialized, as indicated in
> >
> http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes
> > ?
> >
> > Someone asked about combining FormDef and LazyBeans to come up with a
> > form containing indexed properties.  FormDef works with
> > DynaActionForms.  If I have an array or list of dyna forms, I can use
> > FormDef with each element.  The problem is coming up with a lazy,
> > non-session-scope implementation.  I came up with the code snippet at
> > https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=12
> > because I assumed that in order to create a proper ActionForm, it
> > needed to go through FormBeanConfig's createActionForm.  Are lazy dyna
> > forms exempt from this requirement?
> >
> >
> > On Fri, 1 Oct 2004 21:14:25 +0100, Niall Pemberton
> > <[EMAIL PROTECTED]> wrote:
> > > It could, although there is no need for it to be an ActionForm - could
> just
> > > be a LazyDynaBean. Having said that, you would probably want to override
> the
> > > default "indexed" type to be a LazyDynaBean array rather than ArrayList
> as
> > > LazyDynaBean doesn't populate Lists, but it does Arrays.
> > >
> > > public class CustomLazyBean extends LazyDynaBean {
> > >
> > >    public CustomLazyBean() {
> > >         super();
> > >    }
> > >
> > >   protected Object defaultIndexedProperty(String name) {
> > >        return new CustomLazyBean[0];
> > >    }
> > >
> > > }
> > >
> > > <form-bean name="skillForm"
> > >     type="org.apache.struts.validator.LazyValidatorForm>
> > >         <form-property name="skills"
> > >             type="myPackage.CustomLazyBean[]"/>
> > > </form-bean>
> > >
> > >
> > > Niall
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "Hubert Rabago" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Friday, October 01, 2004 8:07 PM
> > > Subject: Re: Indexed Properties and Lazy List behaviour
> > >
> > > > In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
> > > > indexed property.  Can the indexed property itself an array or list of
> > > > Lazy*Form objects?
> > > >
> > > > <form-bean name="skillForm"
> > > >     type="org.apache.struts.validator.LazyValidatorForm>
> > > >         <form-property name="skills"
> > > >             type="org.apache.struts.validator.LazyValidatorForm"/>
> > > > </form-bean>
> > > >

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

Reply via email to