Manually calling execute() will work if execute() only does the initializing
collections or data used on a form. Good idea.

Kathy


----- Original Message -----
From: "None None" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 30, 2004 10:13 AM
Subject: Re: Page pre-processing - reply


> Is your preparation being done in an Action?  If so, why not just
> instantiate it yourself and call execute() manually?
>
> I do something I think is similar to your question in an application I
just
> converted to Struts...
>
> I have  a management-type screen that has a list of users that can be
> maintained.  It also has detail entry fields for maintaining a selected
user
> or creating a new user.  The initial Action that is accessed when the page
> is first shown populates various drop-downs.  Another Action populates the
> list of users (based on some search criteria).  Any time a maintenence
> function is performed, like delete user, update user, etc., I instantiate
> the first two Actions, call execute() on them, passing them the ActionForm
> for the screen from the Action that was actually called.  They do what
they
> need to do, populate the ActionForm, and return.  So, it's like:
>
> UpdateUserAction {
>   PopulateDropDownsAction pdda = new PopulateDropDownsAction();
>   pdda.execute(mapping, form, request, response);
>   ListUsersAction pua = new ListUsersAction();
>   lua.execute(mapping, form, request, response);
>   return forward...
> }
>
> So every Action that is performed on this screen will always "pre-process"
> my form and get any default data populated that should be populated.
>
> It's of course possible I completely misunderstood your question in the
> first place, but if not, this might do the trick for you.  I think people
> sometimes forget that you can manually call Actions from other Actions,
> which is the key point.
>
> >From: <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Subject: Re: Page pre-processing - reply
> >Date: Sat, 29 May 2004 23:42:22 -0400
> >
> >Eric,
> >The way I did was to add the collection to request in Action bean when
the
> >validation of the form failed. The collection was re-initialized as
needed.
> >
> >I have not found any other way in struts yet.
> >
> >Kathy
> >
> >----- Original Message -----
> >From: "Eric Fesler" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >Sent: Saturday, May 29, 2004 11:58 AM
> >Subject: Page pre-processing
> >
> >
> > > Hi,
> > >
> > > I'm currently working on an application with several pages having
> > > multiple combo-boxes.
> > >
> > > The content of the combo-boxes is closely related to other components
of
> > > the model. Therefore, I use a 'prepare' action to setup the model and
> > > put the combo-box collections in the request scope.
> > >
> > > Unfortunately, this way of working is not compatible with the Struts
> > > validation process. Indeed, when the validation of the form failed,
the
> > > request is forwarded back to the input page and the collections are
not
> > > initialized.
> > >
> > > A workaround would be to put the collections in the session scope
(what
> > > I finally did) but at the end the session becomes full of garbage
> > > information. Another solution is to build the collection within the
JSP
> > > page (maybe with custom tags) but this is against the separation of
the
> > > view and the model.
> > >
> > > I was wondering if anybody had already thought about an additional
> > > parameter linked to a struts-forward allowing page pre-processing.
This
> > > parameter could point to a new kind of model action that will complete
> > > the model with information needed by the view any time the forward is
> > > activated.
> > >
> > > Or... I'm missing something ...
> > >
> > >
> > > How do you handle such a case?
> > >
> > > Thanks,
> > >
> > > --Eric
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now!
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
> ---------------------------------------------------------------------
> 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