1 Reply Latest reply: Feb 22, 2013 3:17 PM by gimbal2 RSS

    Two servlets communication with Post method

    853473
      Dear All,

      We have two servlets application running on same server with Java EE 6 with below mention application URL.

      Servlet1 Application URL: http://<severname>/*servlet1*
      Servlet2 Application URL: http://<severname>/*servlet2*

      My question is how to call Servlet2 from Servlet1 with Post method without using server name.
      May be something like this:

      servlet.invoke(servlet2).

      Please help me on this.

      Regards,
      Patana
        • 1. Re: Two servlets communication with Post method
          gimbal2
          You are free to use a relative url without the host name in it. So you'd simply redirect to "servlet2", not "http://blabla.com/servlet2". But you can also consider doing a forward in stead. Before you ask for code, simply google for "java servlet forward" and "java servlet redirect" to get countless examples.