tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghupathy,Gurumoorthy" <gurumoorthy.raghupa...@uk.fid-intl.com>
Subject RE: Accessing resource from another context.. ..
Date Thu, 20 Oct 2005 15:06:55 GMT
It is "" not "/" for root context

-----Original Message-----
From: Archana Mathur [mailto:A.Mathur.1@warwick.ac.uk] 
Sent: 20 October 2005 16:03
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
View raw message