First you need to consider why you are doing this. Whenever I think this is necessary, I usually figure out that the code sharing is more appropriate at build time rather than run time. That may not be the case in your situation, but it's something to carefully consider before diving off.
Moved to the Tomcat forum to discuss cross-context dispatching.
Joined: Dec 23, 2008
I could make the cross context dispatching work.
Following is the code:
There are 2 web applications:
ServletJSPAssignment8 wants to forward the request to a resource in ServletForwardRedirectTest application. The resource in ServletForwardRedirectTest to be invoked is Forward2.jsp
Following are the code snippets:
1) Servlet in ServletJSPAssignment8 that gets the context of ServletForwardRedirectTest and forwards the request to Forward2.jsp in ServletForwardRedirectTest.
2) We also need to modify the context.xml file of Tomcat. By default cross context dispatching is disabled. We have to modify the context tag of context.xml to enable cross context dispatching.
Make the following change in the context.xml file:
This should allow you to communicate between 2 web applications.
As rightly mentioned in the earlier posts by Bear, file sharing (adding Forward2.jsp in ServletJSPAssignment8 in this case) is a much more simpler option.
Cross context dispatching should only be done if you know exactly what you are doing.
Hi Guys, This forum has been pretty useful. But I wanted to ask if cross context dispatching will still work if one Web app is deployed on Tomcat and the other web app on WebSphere Application Server. And if not, what is the solution, if it is through RMI, could you give me few pointers on that. Thanks in Advance,