This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Cross Context in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Cross Context in Tomcat" Watch "Cross Context in Tomcat" New topic
Author

Cross Context in Tomcat

sam prochazka
Greenhorn

Joined: Dec 14, 2002
Posts: 3
Hi,
My server.xml is as follows:
<Host name="localhost" debug="0" appBase="c:/RealPageMaker/webapps" unpackWARs="false">
<Context path="" docBase="webapp1" debug="0" crossContext="true"/>
<Context path="/webapp2" docBase="webapp2" debug="0" crossContext="true"/>
</Host>
The .jsp code in webapp1 is as follows:
<% ServletContext thatctx= application.getContext("/webapp2");
RequestDispatcher rdpt=thatctx.getRequestDispatcher("/test.jsp");
rdpt.forward(request, response); %>
This does not work, but the following does (with an HTML page):
<% ServletContext thatctx= application.getContext("/webapp2");
RequestDispatcher rdpt=thatctx.getRequestDispatcher("/test.htm");
rdpt.forward(request, response); %>
What am I doing wrong? Is this a tomat bug? Has anyone got this working with tomcat 4.1.12?
Sam P.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
This is NOT a web services question. This is getting moved to the Tomcat forum.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Subrmaniam Narayanan Iyer
Greenhorn

Joined: May 28, 2004
Posts: 1
Hi,

In the server.xml of tomcat, u got a context tag. Context tag takes an attribute cross-context, default it is set to false. Probably if u set it to true, it will work.

Hope it works.
 
Consider Paul's rocket mass heater.
 
subject: Cross Context in Tomcat
 
Similar Threads
Changing Tomcat Context in server.xml
cross context in tomcat
passing session values between two web application
servlet reloading
Root Context - mywebapps has no effect