Some times we have to forward our request to some other web applications resource which is running in the same server.We can achieve this by using foreign RequestDispatcher.

Forein RequestDispatcher

ServletContext forienContext=getServletContext().getContext("/WebApp2");
RequestDispatcher rd=forienContext.getRequestDispatcher("/test2");
rd.forward(request, response);

Note: Cross context communication by default won’t supported by most of web servers.Server level configuration changes are required.