Invoking a servlet from another servlet


Web tier: servlets, JSP, Web frameworks: Invoking a servlet from another servlet

  1. Invoking a servlet from another servlet (3 messages)

    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.
    How do I do that???
  2. 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.
    good luck.
  3. Use the javax.servlet.RequestDispatcher




    Now servlet B has control of the original request and the response to write back to.
  4. oops...just read that the servlets are on different machines. sorry for the goof.