You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by James Turner <tu...@blackbear.com> on 2002/08/06 19:54:09 UTC
Bug 10936 and initialization
Hi all,
I'd like to discuss this issue some more. A while back, I submitted a
request to allow an array of arbitrary type to be instantiated in a
DynaForm. Craig responded that you could do this by using an initial=
clause of the appropriate length and registering a converter.
Unfortunately, to the best of my abilities, I haven't been able to get
that approach to work, because it doesn't look like DynaForms call the
converter. Instead they use DynaActionForm.set, which only works for a
limited set of types.
More to the point, I consider this a kind of occam's razor type of
thing. In most cases, if I'm creating an array of objects for a form,
they're a custom class I've written that has placeholders for rows of
data. For example, in my current application, I have dependents for an
insurance subscriber. The form looks like:
L_NAME F_NAME M_INIT GENDER DOB RELATIONSHIP
So I have an object called Dependent, with properties lastName, firstName, etc.
Now I want to declare a DynaForm with 10 of this objects. Remember, I
don't need to initialize the objects to anything, they can be created by
calling the generic instantiator for the class.
So which is simpler:
<form-property name="dependents" type="com.mystuff.Dependents[]" size=10/>
or
<form-property name="dependents" type="com.mystuff.Dependents[]"
initial={'','','','','','','','','',''}/> AND writing a converter and
putting in an initialization routine somewhere in my code to register the
converter.
James
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>