| Author |
Use Servlet to read a webpage.
|
CC Huang
Greenhorn
Joined: Jun 27, 2002
Posts: 1
|
|
Using Servlet, how can I read a webpage via internet into a string object. The webpage could be HTML or JSP. Thanks,
|
 |
Brian Glodde
Ranch Hand
Joined: Jun 27, 2001
Posts: 171
|
|
You'll be using a URLConnection object, then use a DataInputStream to retrieve the output of the page (if it's a server side script). You could then store it in a String or a File structure. Hope that helps!
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
Note that if you use a url starting "http://" you automatically get a HttpURLConnection so look in those docs for the methods that let you set request headers etc. Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Use Servlet to read a webpage.
|
|
|