Hi, maybe the problem is not were we thought it was.
If you get a NullPointerException a (1) (i mean not somewhere deeper
inside 1
but exactly at 1), that can only mean getServletContext() returned false.
This may be the case if servelt was not properly initialized.
Check your init(ServletConfig config) method of your servlet and check twice
it calls it's ancestor's method (super.init(config)) because it's the
ancestor which will set the servlet context.

Nihita Goel a écrit :

> 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