【发布时间】:2011-06-23 08:55:46
【问题描述】:
我正在使用 java 从website 下载搜索结果,该搜索结果非常适合第一页。
URL url = new URL(
"http://www.geocaching.com/seek/nearest.aspx?country_id=79&as=1&ex=0");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
但是我怎样才能得到结果的第二页呢?第二页的链接使用了一个javascript调用javascript:__doPostBack('ctl00$ContentBody$pgrBottom$lbGoToPage_2',''),它调用了这个函数:
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
我想,我需要从我的 java 程序中调用该函数来获取第二页,但是如何?
【问题讨论】:
标签: java javascript url web download