We help IT Professionals succeed at work.

how to get the content output from another servlet?

nphnhi
nphnhi asked
on
245 Views
Last Modified: 2013-11-24
Hello,
I have 2 servlets, one will test the connection, then using out.println(theresult).
Now, the second servlet will get theresult from the first servlet. How to do it?
Thank you very much
Comment
Watch Question

You should to forward the request to the the second servlet once the first servlet is done with its processing.

Author

Commented:
i found the solution.
how to read directory from URL
import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {
      URL yahoo = new URL("http://www.yahoo.com/");
      BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        yahoo.openStream()));

      String inputLine;

      while ((inputLine = in.readLine()) != null)
          System.out.println(inputLine);

      in.close();
    }
}
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.