You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Frank L. Bowar" <fl...@mapp.org> on 2004/05/06 00:20:07 UTC
How to forward to an Action in one web app, from the Action of a different web app
I have 3 different Struts (1.1) web applications all running in the same
Tomcat (4.1) server. When the user presses a button on a form of one of
the applications, tied to a Struts Action, I would like that Action to
be able to forward control to an Action within a different web
application, which would build the page and display it to the user. I
would like this new application to
be able to "remember" who called it, and at some point, when the user
presses a button that says "Return to original application", the new
application will forward the user back to the original application
at/near the point where they first left it.
In my Current Action.execute() method, I'm doing:
MyAction.execute() ...
//Get the servlet context of the application I want to switch to.
ServletContext newContext =
session.getServletContext().getContext("/webmaint");
//The new ServletContext seems to be correct.
//I can find JSP resources but I really want to forward to an Action
in the new application!!
RequestDispatcher rd =
newContext.getRequestDispatcher("/MainFrameSet.jsp");
rd.forward(request, response);
return(null);
The following exception is generated when I execute this action code:
org.apache.jasper.JasperException
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:254)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
her.java:684)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp
atcher.java:432)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat
cher.java:356)
at
org.mappcor.accred.ui.maint.MaintAction.performExecute(MaintAction.java:
342)
at
org.mappcor.jsptools.StrutsBaseAction.execute(StrutsBaseAction.java:117)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
ocessor.java:465)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:78
1)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:58
9)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:666)
at java.lang.Thread.run(Thread.java:534)
Thanks in advance for any thoughts, help or suggestions.
Frank Bowar, Information Systems
MAPPCOR
1125 Energy Park Drive
St. Paul, MN 55108-5001
Phone: 651-632-8784
Fax: 651-632-8417
Cell: 612-220-7324
Frank Bowar, Information Systems
MAPPCOR
1125 Energy Park Drive
St. Paul, MN 55108-5001
Phone: 651-632-8784
Fax: 651-632-8417
Cell: 612-220-7324
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to forward to an Action in one web app, from the Action of
a different web app
Posted by Craig McClanahan <cr...@apache.org>.
Frank L. Bowar wrote:
>I have 3 different Struts (1.1) web applications all running in the same
>Tomcat (4.1) server. When the user presses a button on a form of one of
>the applications, tied to a Struts Action, I would like that Action to
>be able to forward control to an Action within a different web
>application, which would build the page and display it to the user. I
>would like this new application to
>be able to "remember" who called it, and at some point, when the user
>presses a button that says "Return to original application", the new
>application will forward the user back to the original application
>at/near the point where they first left it.
>
>
>
I'm not following Tomcat development closely any longer, but I seem to
recall that cross-context request dispatcher calls were fraught with
problems up until very recent releases of 5.0.x. To make matters more
intricate in your case, 4.1 is now in maintenance mode, so it's unlikely
that a bug report against it would get much attention either. If you
can try this against 5.0.19 or later, I wouldn't be surprised if it works.
As a fallback, consider using redirects instead of forwards.
Craig
PS: Anyone who is running Tomcat 4.x and has the ability to upgrade
should really look at this ... 5.x is more stable, faster, backwards
compatible (for Servlet 2.3 / JSP 1.2 based applications), plus it
enables you to use JSP 2.0 for new stuff.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org