如何读取远程网站页面. 什么意思?是想抓163.com新闻? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是要读取远程主机上一个html页面比如http://xxx/kkk.html然后转成一个String. <jsp:include page="http://xxx/kkk.html"></jsp:include> <form onSubmit="location.href = 'view-source:' + location; return false;"><input type="submit" value="查看源代码!"></form>把location换成网址即可 比如:<form onSubmit="location.href = 'view-source:' + 'http://www.sina.com.cn'; return false;"><input type="submit" value="查看源代码!"></form> 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(); }} 关于JAVA文件上传的问题,已经在不同机器上调试很多遍 用户登录的时候,在短时间内密码连续输错3次,账号被锁定,是怎么实现的呢? ///合作///// 关于一个简单的javabean 在JSP中不能正常取得所有已被选择的复选框的值,怎么办 关于FCKEdit取值 正则表达式的结果为什么是这样的? 上传问题!!!急急急 office在线编辑 在IE中运行applet时出现无法载入class的问题,请问如何设置codebase 一个十分简单的测试,都没通过.可能是让我改坏了,大家帮我看看 为什么改了servlet浏览器仍然访问原来的
http://xxx/kkk.html然后转成一个String.
</jsp:include>
<input type="submit" value="查看源代码!">
</form>把location换成网址即可
<form onSubmit="location.href = 'view-source:' + 'http://www.sina.com.cn'; return false;">
<input type="submit" value="查看源代码!">
</form>
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();
}
}