>>> Stephen Fenelon <[EMAIL PROTECTED]> 19-Dec-00
11:13:20 AM >>>
>Hi I am trying to retrive a url and println it.
>I am using the code below which dosen't seem to work.
>Can anyone point me to a example that does a
>"get" on a url or a work around??
I'm sure you could find one if you looked hard enough.
The problem with your code is that it isn't formatted correctly:
>URL url = new URL("http://www.blah_blah.com/index.html");
>BufferedReader bin = new BufferedReader (
> new InputStreamReader( url.openStream() ));
> String line;
> while ( (line = bin.readLine())
!=null )
> out.println( line );
I think you'll find it works if you change it to this formatting:
URL url = new URL("http://www.blah_blah.com/index.html");
url.connect();
BufferedReader bin = new BufferedReader (
new InputStreamReader( url.openStream() ));
String line=null;
while ( (line = bin.readLine()) !=null )
out.println( line );
Nic Ferrier
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html