什么意思?是想抓163.com新闻?

解决方案 »

  1.   

    就是要读取远程主机上一个html页面比如
    http://xxx/kkk.html然后转成一个String.
      

  2.   

    <jsp:include page="http://xxx/kkk.html">
    </jsp:include>
      

  3.   

    <form onSubmit="location.href = 'view-source:' + location; return false;">
    <input type="submit" value="查看源代码!">
    </form>把location换成网址即可
      

  4.   

    比如:
    <form onSubmit="location.href = 'view-source:' + 'http://www.sina.com.cn'; return false;">
    <input type="submit" value="查看源代码!">
    </form>
      

  5.   

    import java.net.*;
    import java.io.*;public class ReadURL {
    public static void main(String[] args) throws Exception {
    if (args.length != 1) {
    System.out.println("用法:ReadURL <URL地址>");
    return;
    }
    URL url = new URL(args[0]);
    BufferedReader in = new BufferedReader(
    new InputStreamReader(url.openStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();
    }
    }