I've a query regarding JAVA (Reading directly from the URLs). I want to read the contents from URLs. I've just implemented a code in JAVA and it works well. But i want that code to be implemented in JSP. I tried to use this on JSP page but it does not read the contents of the URL. Please help me out.
JAVA CODE
import java.net.*;
import java.io.*;
public class URLReader {
    public static void main(String[] args) throws Exception {
        URL oracle = new URL("http://www.oracle.com/");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(oracle.openStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}
JSP CODE
<%@ page import="java.sql.*,java.net.*,java.io.*,java.lang.*,java.util.*"%>
<html>
<title></title>
<head></head>
<body>
<%
try{
    URL oracle = new URL("http://www.oracle.com/");
    BufferedReader in = new BufferedReader(
    new InputStreamReader(oracle.openStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
    in.close();
    }catch(Exception ex){}
%>
</body>
</html>
I'm using JDK1.5.0_16 and Tomcat Version 3.0
 
     
     
    