想写一个打开一个网页内所有链接的编程
http://hnjtpc.例如这个网站,怎么才能一次性打开一个页面内的所有链接
//打开网页 public void getUrl() throws IOException { String urlString ="http://hnjtpc. url = new URL(urlString); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); BufferedWriter writer = new BufferedWriter(new FileWriter("d:/page.html")); String line; while ((line = reader.readLine()) != null) { //可以对line内容进行URL提取,关注"<a" "href=\"", 对于以"/"开头的网址加上服务器地址,如 "http://baidu.com" writer.write(line); writer.write("\r\n");//保存的文件中,不分行,要额外分行 }