Matt,
The answer to your main question is, "No". You don't have to specify the
form as the input of the preloader. You don't even really have to have a
separate 'pre-loader' action for this form. In any action that will forward
to your JSP page that displays your form, you can create a new form using:
DynaActionForm taxRatesForm = new DynaActionForm();
and
taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates",
allTaxRates);

This will prepopulate the the array and put the form in the request.

Specifying the name="formName" in the action will just give you the form as
the parameter to the execute method. The alternative is to create it
yourself with 'new'.

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.

I'm not clear on the need to put allTaxRates in session scope. Can you send
your JSP code?


-Richard



-----Original Message-----
From: Matt Bathje [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 21, 2003 7:37 AM
To: Struts Users Mailing List
Subject: Re: dynamically sized form (mostly solved)


Might I say - woohoo!!

Thanks to your guys help, I got this working. I just want to make sure that
I'm doing this the best way.

In my struts-config file, the preloader has to have the form named in
addition to having it on the action. The form is setup to be in the request
scope, not in the session scope.

In my preloader action, instead of doing

DynaActionForm taxRatesForm = new DynaActionForm();

I do:

DynaActionForm taxRatesForm = (DynaActionForm) form;

then I just do:
taxRatesForm.set("taxRates", allTaxRates); request.setAttribute("taxRates",
allTaxRates);

In the submit action, I just have to do:
DynaActionForm taxRatesForm = (DynaActionForm) form; TaxRateBean[] taxRates
= 
    (TaxRateBean[]) taxRateForm.get("taxRates");

Everything seems to work pretty slickly. My main question is 
if having to have the name="formName" in the preloader
action is correct? It would be nice to know if I am doing anything else the
"incorrect" way though also. If I didn't explain anything very well and you
want to see code snippets, just let me know.

Thanks,
Matt

---------------------------------------------------------------------
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