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: Accessing resource from another context.. ..
Date Thu, 20 Oct 2005 15:38:14 GMT
thanks Robert it works with this crossContext = "true" attribute. 

>>> rgw@lsoft.com 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:A.Mathur.1@warwick.ac.uk] 
> 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: users-unsubscribe@tomcat.apache.org 
For additional commands, e-mail: users-help@tomcat.apache.org 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message