Created
March 3, 2011 15:41
-
-
Save japaz/852959 to your computer and use it in GitHub Desktop.
Example jsp include from other context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="javax.servlet.ServletContext" %> | |
<%@page import="javax.servlet.RequestDispatcher" %> | |
<% | |
ServletContext servletcontext = pageContext.getServletContext(); | |
ServletContext servletcontext1 = servletcontext.getContext("/testAPP/v/a.jsp"); | |
if (servletcontext1 != null) { | |
out.println("SC is not null"); | |
RequestDispatcher requestdispatcher = servletcontext1.getRequestDispatcher("/v/a.jsp"); | |
if (requestdispatcher != null){ | |
out.println("RD is not null"); | |
requestdispatcher.include(request,response); | |
} else { | |
out.println("RD is null"); | |
} | |
} else { | |
out.println("SC is null"); | |
} | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment