You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rune Salthaug <ru...@ementor.se> on 2001/11/21 11:36:34 UTC
Forward from one Action-instance to another
My case (simplified):
Given an application with these two action-mappings:
<action path="/index" type="IndexAction">
<forward name="success" path="/index.jsp"/>
</action>
<action path="/foo" type="FooAction">
<forward name="success" path="/index.jsp"/>
</action>
My IndexAction's perform-method adds some stuff on the HttpServletRequest
that is used by the index.jsp page. Let's say fetch a Collection of objets
from persistent storage. The index.jsp might then iterate through the
Collection and display its objects in some way.
The FooAction's perform-method does something else to respond to a request
for the /foo.do URL. When the FooAction.perform() has done its job, I want
to do whatever is necessary to display index.jsp properly. Now, I don't like
the idea of duplicating the functionality of IndexAction.perform() in
FooAction.perform(). So, I thought a forward to IndexAction would be nice,
just to make sure the necessary data are available to the index.jsp page.
My questions:
Can anyone recommend a way to do this?
And can it be done without hard-coding the IndexAction name in my Java-code
in any way? (To make it flexible and reconfigurable)
Any answer appreciated,
Rune Salthaug
Ementor Sweden AB
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>