tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archana Mathur <a.mathu...@warwick.ac.uk>
Subject Re: How to share resources across two applications
Date Thu, 27 Oct 2005 12:47:56 GMT
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message