This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Suppose i have a servlet in one Context (1 jvm) and i want to forward the request to another servlet in another context(different JVM), what to choose from sendRedirect or RequestDispatcher.forward Rgrds
Ravish, I think you can get around this issue by getting a reference to the other target ServletContext with this.getServletContext.getContext(uripath). Then using this new target ServletContext you can get a RequestDispatcher and you should then be set. Bob Kerfoot SCJP 1.2 SCWCD
Pradeep, You are correct. In the server.xml file you would need to ensure that the crossContext attribute was set to true in the context element for the application you were trying to connect to. If network traffic to and from your server was an issue it might be better not to use the sendRedirect() as you now have two request, response round trips instead of the server centric forward which handles the routing without going back to the client. Bob Kerfoot SCJP 1.2 SCWCD