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 Accessing resource from another context.. ..
Date Thu, 20 Oct 2005 15:03:24 GMT
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
 


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