You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Bartsch Axel <Ax...@srit.siemens.fr> on 2001/05/18 14:41:03 UTC

forward a request from servlet1 in TOMCAT1 to a servlet2 in TOMCA T2

Hi,

I am using TOMCAT 3.3 and the following code within servlet1 to forward a request

String url;
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(request,response);

servlet1 is called as follows:
http://<IP-adress>/test/servlet/servlet1

The TOMCAT directory:

c:\TOMCAT\webapps\test

from here subdirectorys 'common' and 'Web-inf' exist

servlet1 is known in web.xml

String url is defined as follows:
from servlet1 to servlet2
/servlet2

servlet2 is kown  in web.xml

from servlet1 to jsp2

/common/index.jsp


This works fine as long as servlet1 and servlet2, servlet1 and jsp2 are located and known in the same TOMCAT servlet engine.

My problem is:
If servlet1 and servlet2, servlet1 and jsp2 are located on 2 different instances of the TOMCAT servlet engine the forward does not work.
The RequestDispatcher always expects a path String relative to the root of the ServletContext.
Does anybody know a solution?


Axel   Lannion/France