You're right Jon. Thanks for the tip! Cyril. ----- Original Message ----- From: "Jon Wingfield" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, November 21, 2003 11:19 AM Subject: Re: getContext returns null!
> I think you may need to set your Context to be crossContext. > > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html > > HTH, > > Jon > > > cyril vidal wrote: > > Hi, > > > > I just would like to get a reference to the ServletContext of another web application as the current one, to get a RequestDispatcher object. > > > > I know that the path should begin with / and that it is interpreted relative to the server's document root . > > > > So i'm in a web application context and would like to get the context of c:\tomcat\webapps\tutobean application. > > > > I've written the following code: > > > > protected void doGet(HttpServletRequest req, HttpServletResponse rep) > > > > throws ServletException, IOException { > > > > ServletContext currentSC = getServletContext(); //reference to the current ServletContext > > > > ServletContext distantSC = currentSC.getContext("/tutobean"); //reference to the ServletContext of tutobean webappl, corresponding to http://localhost:8080/tutobean. > > > > distantSC.getRequestDispatcher("/index.html").forward(req,rep); //NullPOinterException here because distantSC is null!!! > > > > > > > > What's wrong in my code? > > > > Thanks for your response, > > > > Regards, > > > > Cyril. > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]