Wendy Smoak wrote:
Let us know how the multiboxes work with lazy forms -- I had trouble
with lists in regular DynaValidatorForms until I switched to using
Commons Collections 'GrowthList' instead of String[] or ArrayList.
Hi Wendy,

The multibox thing seems to be a little tricky... I looked through the LazyDynaBean class. When you don't define the properties explicitly in the struts-config.xml, the type defaults to Object. The bean utils try to coerce the String[] to an Object by doing what amounts to ( (String[])value )[0], which discards everything but the first element.

I honestly can't figure out why they would do this. If you can't figure out the type and the array has more than 1 element, it should just leave it as String[], and only convert it if it's absolutely positive that the target can't handle a String[] or has otherwise said it needs a String.

So I'm left with the possibility of editing the source and breaking everything that depends on this behavior, or defining all my array properties in the form. Here's the thing though--I decided to try out the whole lazy thing so I could generate all this stuff on the fly. SO what I may do is extend the LazyDynaBean class (and find out how to hook the thing into Struts when it uses my LazyValidatorForm class), so it can tell the beanutils when it encounters an array property.

Though the short-term solution might be if I define all the array properties in struts-config.xml. So let's say I have 10 entities, each with 1-2 array properties, for about 15 array properties. Can I just go ahead and define all 15 in the <form-bean ...>... </form-bean> element, or will that just waste space with a least-common-multiple type approach?

Thanks,
 Scott


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

Reply via email to