struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: ActionClass chaining
Date Fri, 15 Sep 2000 00:47:18 GMT
Juan Gargiulo wrote:

> Hi,
> Struts defines that an Action class processes the request and returns the
> control to a JSP (defined by the ActionForward object). But it is correct to
> forward the control to another ActionClass? What if we need to perform
> different logic to go from one page to the other?
> One example scenario where this is required could be the following:
> -loginPage -> Controller -> LogonAction (User validation) -> HomePageAction
> (Home page generation) -> homePage

You can actually do this with the existing version of Struts, by using a path
that resolves to HomePageAction instead of a path to a JSP page, as you set up
your forward.  When the action servlet executes the RequestDispatcher.forward(),
control will be forwarded back to the controller servlet again -- and the second
action will be performed.

As far as "correctness" goes, I guess if I used this technique in the example
app it must be OK :-).  If you look at the /saveSubsription action, you'll see
that I define a <forward> element that has the path
"/" -- which causes two actions in a row to be
executed before control is ultimately returned to the JSP page.

> Thanks in advance for your help,
> juan


See you at ApacheCon Europe <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message