On 21 Nov 2003, at 18:29, Matt Bathje wrote:


DynaActionForm taxRatesForm = new DynaActionForm();
and
taxRatesForm.set("taxRates", allTaxRates);
request.setAttribute("taxRates",
allTaxRates);

Creating a form in the action servlet is one sure way to piss the folks
off who have to maintain the app. You might think its big n clever, but
you'd be hiding the form away in a class, what do the htmlists do?

Well this does not work for me anyway. When I change the code to do what Richard suggests, I get null pointer exceptions.

So is what you are saying Mark is that the way I am doing this (have
the form name specified on the preloader action, and do
DynaActionForm taxRateForm = (DynaActionForm) form;
in the preloader action class) is correct?
Yep



<form-property name="taxRate" type="java.util.ArrayList" />

Using arraylist means you dont have to use the lazy list initialization
that i think that using an array will require. See bean utils for
details. I could be full of shit but I have this working with arrayList
and no joy with using arrays of beans.



It is working fine for me with an array of beans. I'm not entirely sure what you mean by lazy list initalization, or how it could be a problem here. (I couldn't find a reference in the BeanUtils api, and googling for it didn't return much other than standard java lazy instantiation which from my Java knowledge isn't a problem...)

Could be true.. I've had it working with arraylist, if it works as an array i;d like to know.



I think you have the choice of putting the form in either session or
request
scope. Request scope is generally preferable b/c the memory gets
released
sooner.

Yeah right .. Nullpointerexception tastic. Last I looked scoping to request wont work , so don't bother.

My form is in the request scope and working fine. I agree with Richard
in preferring request scope, but if there is a valid reason for it to be
in session instead I'd move it there.

If your dynamically changing the size of the array.. I doubt it, unless somethings been fixed.. Submit the form before you assume it works fine..


If it still works then great..

Cheers Mark



Matt Bathje


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



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



Reply via email to