thanks Robert it works with this crossContext = "true" attribute. 

>>> [EMAIL PROTECTED] 10/20/05 04:21pm >>>
Remember that you have to configure your web context "app1" to
allow cross-context access. If you have not done so, the method
you call below will always return null.

So your context xml file should look similar to this here:

<Context docBase="YOUR_DOC_BASE" crossContext="true"/>

I.e. the parameter crossContext="true" must be there, otherwise
all calls to getContext() with whatever cross-context path will
return null.

Robert

> -----Original Message-----
> From: Archana Mathur [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 20, 2005 5:03 PM
> To: <Tomcat Users List
> Subject: Accessing resource from another context.. ..
> 
> 
> Hi,
> I have got a jsp page a.jsp within tomcat 5.5.9 application 
> (say app1). I need to access some other page a2  which is at 
> different location ( at root context) within a.jsp.
> Example - http://localhost/app1/a.jsp - (a.jsp  wants access 
> to other jsp which is at location (http://localhost/a2.jsp) - 
> root context
>  
> tag jsp:include  will only pick up pages from current context (app1)
>  
> I added had some code in my jsp page  to make it working -
> ServletContext ctx = pageContext.getServletContext().getContext("/");
> String myUrl = "/a2.jsp"; 
>  RequestDispatcher dispatcher = ctx.getRequestDispatcher(myUrl); 
>  dispatcher.include(request, response);
> Somehow getContext("/") returns me null. After reading 
> getContext method ,it mentions - " In security conscious 
> environments, the servlet engine can return null for a given 
> URL."  What do I need to do so that this getContext("/") 
> doen't return null value. 
>  
> Please help..
>  
> Archana
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


Reply via email to