Archive for October, 2010

Inter-Servlet Communication using a request dispatcher

Published by Rob on October 26th, 2010 - in Miscellaneous

In code, here is how to pull in data from a different JEE web-app

1
2
3
4
5
String pathToWebApp ="/otherApp"
String pathToServlet ="/myServlet" //relative to the otherApp context
ServletContext configContext = context.getContext(pathToWebApp);
RequestDispatcher dispatcher = configContext.getRequestDispatcher(pathToServlet);
dispatcher.include(request, response);
© Rob@Rojotek