I am trying to get a context across web apps so that I can include JSP page in another web app as follows:
ServletConext ctx1 = config.getServletContext();
ServletConext ctx2 = ctx1.getServletContext("/aa/bb");
RequestDispatcher rd = ctx2.getRequestDispatcher("/cc");
However, the first web context I have is "/aa" and the second one is "/aa/bb." At runtime, it doesn't seem to resolve "/aa/bb" correctly. Instead, it gave me the same reference as ctx1. This code runs fine if the second context doesn't start with "/aa". I guess somehow app server thought "aa/bb" is a part of "aa".
Am I violating any Servlet spec or missing something here? What is the right way to do it without changing the context names. Any workaround? I run this JBoss 4, by the way.
Thanks a lot!