How do I get the output of an included servlet

Discussions

Web tier: servlets, JSP, Web frameworks: How do I get the output of an included servlet

  1. How do I get the output of an included servlet (2 messages)

    I am trying to invoke another servlet from my main controller servlet and get it's output for further processing but I can't figure out how to do it. I tried reading from the inputstream after calling the include method but that didn't work. Any suggestions are appreciated.

    Thanks
    Eric
  2. How do I get the output of an included servlet[ Go to top ]

    try following:

            String line="",str,url,host;
            url=request.getParameter("url");
            host=request.getServerName();
            url="http://"+host + url;
            if (url!=null){
              URL u = new URL(url );
              DataInputStream server = new DataInputStream(u.openStream());
              while((str= server.readLine()) != null){
                line+=str;
              }
            }

    help it is useful to you.
  3. How do I get the output of an included servlet[ Go to top ]

    Thanks much. that example does help.