The best thing, really, is to have a business object to do each thing.
You can then call one, the other, or both from an Action. In practice,
the Action should be less like a method and more like a macro. It just
calls this business method or that business method, or this one and then
that one. Then, you are only replicating calls between methods not any
original code. 

This approach works well with using a base business class, like the
Scaffold SuperAction. You can setup the usual Action code the way you
like it, and then just override one hotspot method to call your business
logic. 

<
http://cvs.apache.org/viewcvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/SuperAction.java
>

But to chain Actions, you can just put the Action's URI inside an
ActionForward, same as a JSP. Just remember that the container handles
the forwarding, so when the request comes back the ActionServlet will
treat it just like a new request, and do the whole autopopulation thing
from scratch. This sometimes confuses developers who make a change in an
ActionForm value that is repopulated from the request when they forward
between Actions. 

One way around that is to put a mutable switch on your ActionForm. This
can be used to turn off the mutators so that values are not changed by
the ActionServlet. 

<
http://cvs.apache.org/viewcvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/SuperForm.java
>

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


[EMAIL PROTECTED] wrote:
> 
> How do I best chain Actions?
> For example one to save data from a formular and
> one for getting the data for the new page.
> 
> Or is it better to have just one action which can do
> both jobs?
> 
> Is there any good article on the web?
> 
> ----------------------------------------------------------------------------
> ----------------
> Hanel Matthias
> Fachinformatiker (Anwendungsentwicklung) in Ausbildung
> Logistik World GmbH     Fon:    +49-841-9014-300
> Marie-Curie-Strasse 6   Fax:    +49-841-9014-302
> D- 85055 Ingolstadt     mailto:[EMAIL PROTECTED]
> ----------------------------------------------------------------------------
> ----------------
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

Reply via email to