我正在使用Jtidy解析器从java中的网页获取图像。如何在点击java中的图像时打开特定链接?
URL url = new URL("www.yahoo.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
InputStream in = conn.getInputStream();
Document doc = new Tidy().parseDOM(in, null);
NodeList img = doc.getElementsByTagName("img");
ArrayList<String> list = new ArrayList<String>();
list.add(img.item(0).getAttributes().getNamedItem("src").getNodeValue());
它工作正常,从上面的代码我得到的图像。如何打开链接“www.yahoo.com”点击在Java中的图像?