Maybe already well known for a lot of you but I have found a helpful trick for me to prepopulate a page with form.

From a previous action, put in request a usual bean as value object (maybe a
instance of the ActionForm manually instantiated) filled with the data that you want to prefill and under request (or session) attribute name equals to the ActionForm name of the form page.

In that way you do not need to declare the form in the struts-config for the previous action, since Struts thinks that such a value object is its ActionForm.

Hope it can help to someone,

Adolfo.






From: "Durham David Cntr 805CSS/SCBE" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: RE: [Newbie] ActionForm prepopulation
Date: Wed, 29 Jan 2003 15:01:06 -0600

The project I'm working on goes something like .do -> .do -> .do ... no .jsp except those forwarded to by a .do. Haha, I'm insane and I can not be stopped. Just .do it!

-Dave



> -----Original Message-----
> From: Jarnot Voytek Contr AU HQ/SC
> Sent: Wednesday, January 29, 2003 2:54 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [Newbie] ActionForm prepopulation
>
>
> Why is JSP -> .do -> .do -> JSP bad?
>
> I don't think you could make a case for doing population in
> the form bean
> constructor - too much logic. Besides, it wouldn't work, as that same
> constructor would be called when the user submitted the form
> - you wouldn't
> want to redo the database calls then, right? We don't do
> action -> action
> very often (don't need to), but when needed it works fine.
>
> --
> Voytek Jarnot
> Quidquid latine dictum sit, altum viditur.
>
>
> > -----Original Message-----
> > From: Bredesen, Chris - NA US HQ Delray
> > [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 2:43 PM
> > To: Struts Users Mailing List (E-mail)
> > Subject: [Newbie] ActionForm prepopulation
> >
> >
> > Hi group,
> >
> > There's one general struts concept that I haven't fully
> gotten my arms
> > around yet. I'm trying to design without using action
> > chaining, but I have
> > the following scenario:
> >
> > - JSP posts to an action which accesses a form bean and does
> > some business
> > logic
> > - The next JSP in the process has a DIFFERENT form bean on
> > it, and values on
> > that one must be prepopulated using ... another action?
> >
> > This would cause JSP -> .do -> .do -> JSP which we know is bad.
> >
> > So then do I pre-pop my Form bean values in the ActionForm
> > constructor? As
> > member variables? What happens when reset() is called ...
> > how do I make
> > sure they return to their proper initial values upon reset?
> >
> > Thanks for participating,
> >
> > Chris
> > *Struts Evangelist in Training*
> >
> >
> ---------------------------------------------------------------------
> > 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]
>
>

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

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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

Reply via email to