If you go with the original intent of the ActionForm (as I understand
it), the "canonical" answer would be that one HTML form should always
map to one ActionForm.
Today, people have used ActionForms in all sorts of "non-canonical"
ways, and have found that some are better than others. For instance,
some people advocate a single ActionForm for an entire application
(usually stored in session). At first this sounds, well, bonkers!, but
it does have some benefits, namely less code involved (whether it's a
single class or a single DynaActionForm definition). I'm *not* saying
you should do that, just pointing out how ActionForms can be used in all
sorts of (originally) unintended ways.
Michael's answer is another approach that also has its benefits (and
probably drawbacks too, but you would have to decide that).
In your specific case, my advice would be a single ActionForm that
covers your entire "wizard" process, which is what it sounds like your
essentially doing. I can tell you I've personally done that, and I have
also taken the "one ActionForm per wizard page" approach. Both work
just fine, and I'm not sure one is more "right" than the other in this
day and age, but I'd lean towards the one ActionForm approach now I
think, just for the sake of simplicity. The one thing to keep in mind
if you go that route is to be sure you don't have a field on one page
with the same name as another. I had one junior developer make that
mistake and it drove him nuts trying to figure out what was wrong
(obvious in retrospect, but one of those "tricky at the time" problems
to solve).
Frank
Michael Jouravlev wrote:
On 11/16/05, Asad Habib <[EMAIL PROTECTED]> wrote:
Hello. I am new to Struts and would like some advice. Is it better to use
one form bean to capture data from several forms that are being submitted
in succession or to use one form bean per form (i.e. multiple form beans)?
What are the advantages or disadvantages of either approach? Also, I would
appreciate if you would forward me to documents on the web, book chapters,
etc., that discuss this in detail. Thank you.
I prefer using one formbean. And one action too. Is this looks similar
to what you want to achieve:
http://www.superinterface.com/wizard/signupWizard.do
You can read about my approach here:
http://struts.sourceforge.net/strutsdialogs/wizardaction.html
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]