由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - java and javascript 问题请教,有包子
相关主题
JAVA URL question, help读文件时,如何才能只将空白符当成分隔符?
Java menu accelerator not working问个简单的Java技术问题
[转载] 这个是什么错误呀?大侠们帮忙,抓网页时遇到的问题,关于javascript
请教参数传递问题htmlunit中的classpath问题,总是找不到package
java 1.4 直接处理 http?Re: XML help?
Java XML parser的问题JavaCC/SableCC/otherCC ?
[转载] Java Regular Expression Question //bow !help! XML parse problem
可以用Java 做机器人吗?parse Date in DateFormat
相关话题的讨论汇总
话题: java话题: import话题: javascript话题: website话题: should
进入Java版参与讨论
1 (共1页)
l*****0
发帖数: 179
1
The following code written in JAVA should go to a website and download the
html and parse the contents to find the distance between 2 addresses.
But my problem is , The website uses Javascript to return the value of the
distance which JAVA cannot see it when it downloads the html. It's said I
should call the JAVAscript in my JAVA code which I have no clue.
code:
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;

g*****g
发帖数: 34805
2
try htmlunit, they build in a javasript engine so you should be able
to get whatever calculated by js.

【在 l*****0 的大作中提到】
: The following code written in JAVA should go to a website and download the
: html and parse the contents to find the distance between 2 addresses.
: But my problem is , The website uses Javascript to return the value of the
: distance which JAVA cannot see it when it downloads the html. It's said I
: should call the JAVAscript in my JAVA code which I have no clue.
: code:
: import java.lang.*;
: import java.io.*;
: import java.net.*;
: import java.util.*;

Z****e
发帖数: 2999
3
try a different map provider, especially those providing mobile version of
map website, e.g.
http://m.live.com/search/search.aspx?A=routeview&D=MAP&SA=121+Amelia+St%2c+++Mc+Kees+Rocks%2c+PA+15136-3432&EA=300+Ewing+Rd%2c+++Mc+Kees+Rocks%2c+PA+15136-1886
This page has the distance data in plain text
You should know that, most mapping website use JS in web version or provide
a client app in mobile version for exactly this reason: making it difficult
to "steal" their service, so if you use it somewh

【在 l*****0 的大作中提到】
: The following code written in JAVA should go to a website and download the
: html and parse the contents to find the distance between 2 addresses.
: But my problem is , The website uses Javascript to return the value of the
: distance which JAVA cannot see it when it downloads the html. It's said I
: should call the JAVAscript in my JAVA code which I have no clue.
: code:
: import java.lang.*;
: import java.io.*;
: import java.net.*;
: import java.util.*;

l*****0
发帖数: 179
4
I haven't tried it. are you sure it allows me to manipulate the javacript
functions used by other websites instead of mine?

【在 g*****g 的大作中提到】
: try htmlunit, they build in a javasript engine so you should be able
: to get whatever calculated by js.

l*****0
发帖数: 179
5
pure research purpose.
The one you provided looks cool.
For your benefit. one big drawback: when this website doesn't recognize an
address, it would use an address the website thinks the best without asking
your advice. Sometimes the result is very ridiculous.
I tested. The correct one should be 3.72 miles. This website returns 326.1
mi (about 5 hours, 18 minutes with traffic).

provide
difficult
get

【在 Z****e 的大作中提到】
: try a different map provider, especially those providing mobile version of
: map website, e.g.
: http://m.live.com/search/search.aspx?A=routeview&D=MAP&SA=121+Amelia+St%2c+++Mc+Kees+Rocks%2c+PA+15136-3432&EA=300+Ewing+Rd%2c+++Mc+Kees+Rocks%2c+PA+15136-1886
: This page has the distance data in plain text
: You should know that, most mapping website use JS in web version or provide
: a client app in mobile version for exactly this reason: making it difficult
: to "steal" their service, so if you use it somewh

g*****g
发帖数: 34805
6
It allows you to have the page as you see it. Not sure it supports all js,
but at least you can try.

【在 l*****0 的大作中提到】
: I haven't tried it. are you sure it allows me to manipulate the javacript
: functions used by other websites instead of mine?

Z****e
发帖数: 2999
7
it gives no error indication when address is not found
but with the addresses in your link, it should be possible to accurately
determine the distance, otherwise probably you did not provide address in
the correct format?

asking

【在 l*****0 的大作中提到】
: pure research purpose.
: The one you provided looks cool.
: For your benefit. one big drawback: when this website doesn't recognize an
: address, it would use an address the website thinks the best without asking
: your advice. Sometimes the result is very ridiculous.
: I tested. The correct one should be 3.72 miles. This website returns 326.1
: mi (about 5 hours, 18 minutes with traffic).
:
: provide
: difficult

l*****0
发帖数: 179
8
thanks all. I'm ready to send out the forum money.
l*****0
发帖数: 179
9
the money has been sent to zeeGee and goodbug. ...
May I know how to make money here?
k***r
发帖数: 4260
10
I'm not familiar with map service but I suppose it's better to use their
webservice rather than parsing the page. They may change the page anytime
they want and that will break your site.

【在 l*****0 的大作中提到】
: The following code written in JAVA should go to a website and download the
: html and parse the contents to find the distance between 2 addresses.
: But my problem is , The website uses Javascript to return the value of the
: distance which JAVA cannot see it when it downloads the html. It's said I
: should call the JAVAscript in my JAVA code which I have no clue.
: code:
: import java.lang.*;
: import java.io.*;
: import java.net.*;
: import java.util.*;

1 (共1页)
进入Java版参与讨论
相关主题
parse Date in DateFormatjava 1.4 直接处理 http?
Anybody here used apache Lucene?Java XML parser的问题
Java HTMLEditorKit 中取得html的text?[转载] Java Regular Expression Question //bow !
Question about tab 可以用Java 做机器人吗?
JAVA URL question, help读文件时,如何才能只将空白符当成分隔符?
Java menu accelerator not working问个简单的Java技术问题
[转载] 这个是什么错误呀?大侠们帮忙,抓网页时遇到的问题,关于javascript
请教参数传递问题htmlunit中的classpath问题,总是找不到package
相关话题的讨论汇总
话题: java话题: import话题: javascript话题: website话题: should