Web tier: servlets, JSP, Web frameworks: Invoking a servlet from another servlet
I need to invoke a servlet "B" from servlet "A", both the servlets are running on Apps servers running on separate machines. Servlet B, then should respond to the original client request.
- Posted by: Sameer Jog
- Posted on: May 30 2002 19:29 EDT
How do I do that???
open a new URL by the string
such as "http://xxx:xx/root/XXX?name=value"
"name=value" is from your original request,if you want the parameter which is from the original session,,you should get it first and format to "name=value" and then add it behind the url string.
Use the javax.servlet.RequestDispatcher
Now servlet B has control of the original request and the response to write back to.
oops...just read that the servlets are on different machines. sorry for the goof.