简体   繁体   English

从其他站点获取数据并显示在我们的页面中。

[英]Fetching data from the other sites and displaying into our page.?

Is ther any way to get data from other sites and display in our jsp pages dynamically. 有什么方法可以从其他站点获取数据并动态显示在我们的jsp页面中。

http://www.dictionary30.com/meaning/Misty see this url in that one block is like Wikipedia Meaning and Definition on 'Misty' http://www.dictionary30.com/含义/ Misty看到此URL,因为其中一个块类似于Wikipedia在“ Misty”上的含义和定义
In that block they are fetching the data from Wikipedia and displaying into dictionaly30. 在该区块中,他们从Wikipedia中获取数据并显示为dictionaly30。 Question: How they are fetching wiki data to their site.? 问:他们如何将Wiki数据获取到其站点? I need to display data like that in my jsp page by fetching from other site. 我需要通过从其他站点获取来在我的jsp页面中显示类似的数据。

You can use URLConnection and read other site's data. 您可以使用URLConnection并读取其他站点的数据。

or better you use JSoup it will also parse specific data for you from some other site. 或者更好的是使用JSoup ,它将从其他站点为您解析特定数据。

for your case 对于你的情况

Document document = Jsoup.parse(new URL("http://www.dictionary30.com/meaning/Misty"), 10000);
Element div = document.select("div[id=contentbox]").first();

System.out.println(div.html());

您可以使用URLConnection从服务器端的其他站点获取数据,并将此数据提供给jsp页面。

Do make sure you get permission first from the site owners before doing anything like that. 在执行此类操作之前,请确保先获得网站所有者的许可。 Most people don't take kindly to their data being leeched by others, especially as it costs them money and doesn't generate any (advertising) income. 大多数人不善待他人窃取自己的数据,尤其是因为这会花费他们钱,并且不会产生任何(广告)收入。

It's also very risky in that your own site/application will quickly fail as soon as the site you're leeching from gets changed to a different layout. 这也是非常危险的,因为一旦您要迁移的站点更改为其他布局,您自己的站点/应用程序就会迅速失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM