In order to access resource of other applications, you have to set parameter crossContext = "true" in context.xml file of application w1.
Example -
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/w1app" path="/w1app" crossContext = "true"/>

getServletContext().getContext("/w2app") will not return null, if you set this 
parameter.



Nihita Goel wrote:

Hi,
I have two applications running on the tomcat application server.
w1 - with context path "/w1app"
and w2 with context path "/w2app"
I wish to provide links in w1 displaying pages of w2.

I have used this code in my HttpServlet class of w1

if  /// some condition

Servlet Context othercontext = getServletContext().getContext("/w2app"); (1)
RequestDispatcher rd = othercontext.getRequestDispatcher(url); (2)
rd.forward (request,response) (3)

However - the it gives a NullPointerException at 1.

I have been trying hard but without success..

Thanks





---------------------------------------------------------------------
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]

Reply via email to