Web tier: servlets, JSP, Web frameworks: accessing servlet from JSP when they are on different servers
- Posted by: Abhishek Pande
- Posted on: April 15 2002 05:00 EDT
I have a JSP on an iplanet server. I need to invoke a servlet that resides on a weblogic server. This is to be done by using the RequestDispatcher in the JSP and including this servlet (i.e. by using the RequestDispatcher.include() method). Is this possible? I am facing problems in getting the context of the servlet because it is on a different server. If it is possible, what should be the the parameter in the getRequestDispatcher method? Currently it is as follows in the JSP:
Dispatcher = request.getRequestDispatcher("http://:7001/ServletSV");
- accessing servlet from JSP when they are on different servers by Saruman White on April 15 2002 13:01 EDT
This is an excerpt from the API for getRequestDispatcher(java.lang.String path)
...The pathname specified may be relative, although it cannot extend outside the current servlet context...
Your second server is thus definitely out of bounds. You have to use standard means of accessing HTTP servers: read from URLConnection etc.