[quote]http://ajaxian.com/archives/integrating-maps-into-your-java-web-application-with-google-maps-and-ajax[/quote]
John Ferguson Smart has written a nice article on Integrating Maps into Your Java Web Application with Google Maps and Ajax.
The article focuses on the Google Maps API (the only server side
piece is a simple Servlet), and takes you through learning the API, and
then using more advanced techniques such as dynamic markers, and
ondemand (via ajax) content inclusion:
JAVASCRIPT:
1.
2.
function fetchDetails(id) {
3.
var req = GXmlHttp.create();
4.
req.open("GET", "/maps/SiteDirectory?id="+id, true);
5.
req.onreadystatechange = getCallbackFunction(req, displayDetails);
6.
req.send(null);
7.
}
8.
9.
function displayDetails(siteDetailsXML) {
10.
// Get the root "site" element from the document
11.
var site = siteDetailsXML.getElementsByTagName("site")[0];
12.
var name = getNodeValue(site.getElementsByTagName("name")[0]);
13.
var id = getNodeValue(site.getElementsByTagName("id")[0]);
14.
var symbol = getNodeValue(siteDetailsXML.getElementsByTagName("symbol")[0]);
15.
var website = getNodeValue(siteDetailsXML.getElementsByTagName("website")[0]);
16.
var address = site.getElementsByTagName("address")[0]
17.
var address1 = getNodeValue(siteDetailsXML.getElementsByTagName("line1")[0]);
18.
var address2 = getNodeValue(siteDetailsXML.getElementsByTagName("line2")[0]);
19.
var city = getNodeValue(siteDetailsXML.getElementsByTagName("city")[0]);
20.
var postcode = getNodeValue(siteDetailsXML.getElementsByTagName("postcode")[0]);
21.
22.
marker = getMarker(id);
23.
marker.showMapBlowup();
24.
var html = '<span class="site-title-line">'
25.
+ name + ' (' + symbol + ')'
26.
+'</span>'
27.
+ '<span class="site-details-line">'
28.
+ address1
29.
+'</span>'
30.
+ '<span class="site-details-line">'
31.
+ address2
32.
+'</span>'
33.
+ '<span class="site-details-line">'
34.
+ city + ' ' + postcode
35.
+'</span>'
36.
+ '<span class="site-details-line">'
37.
+ '<a href="' + website + '">' + website + '</a>'
38.
+'</span>'
39.
marker.openInfoWindowHtml(html);
40.
}
41.
分享到:
相关推荐
Finally, we also look at what is required to call the second example from a C# application. The techniques used in this paper are relevant and applicable for developers using C++Builder to write ...
Real-time Web Application Development with Vert.x will guide you step-by-step through building a Vert.x application so that you’ll be able to start building one of your own in no time. From ...
Real-time Web Application Development with Vert.x will guide you step-by-step through building a Vert.x application so that you’ll be able to start building one of your own in no time. From ...
Integrating your application with Bootstrap, validating user input, interacting with databases, and deploying your application are some of the things that you will learn to execute with this fast-...
### 整合 JMeter 与 Ant 的方法及实践 #### 概述 在软件开发过程中,性能测试是一项至关重要的任务,它有助于确保应用程序能够在高负载下稳定运行。JMeter 是一款广泛使用的开源负载测试工具,它能够模拟大量并发...
8 Designing Your Web Database 9 Creating Your Web Database 10 Working with Your MySQL Database 11 Accessing Your MySQL Database from the Web with PHP 12 Advanced MySQL Administration 13 Advanced MySQL...
end guide on how to dismantle your monolithic application and embrace the microservice architecture - right from architecting your services and modeling them to integrating them into your application....
■CHAPTER 6 Styling the Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 ■CHAPTER 7 Building the Blogging System . . . . . . . . . . . . . . . . . . . . . . . ....
【ORDERED NEURONS INTEGRATING TREE STRUCTURES INTO RECURRENT NEURA】 自然语言的理解与处理在人工智能领域中占据着核心地位,尤其是对于自然语言处理(NLP)算法来说,理解和利用语言的内在层次结构至关重要。...
● Integrating AWS Cloudwatch, SES, and other AWS services into your code. ● Using AWS Route 53 to configure your domain to use a load balancer, CDN, and other performance-enhancing services into ...
Chapter 8 Designing Your Web Database Chapter 9 Creating Your Web Database Chapter 10 Working with Your MySQL Database Chapter 11 Accessing Your MySQL Database from the Web with PHP Chapter 12 ...
Integrating SQLite into Our Application Chapter 10. Making our Application Real Time with Web Sockets Chapter 11. Deploying our application to Firebase Chapter 12. Using Firebase APIs to Update Our ...
Unlike ad hoc security assessments, these recipes are repeatable, concise, and systematic-perfect for integrating into your regular test suite. Recipes cover the basics from observing messages ...
In the book, you'll learn the technologies and techniques needed to create your own Web services for use in JSP applications. Written by programmers for programmers, the book will help you ...
Prentice Hall - Service Oriented Architecture A Field Guide to Integrating XML and Web Services (2004) Prentice Hall - Service Oriented Architecture A Field Guide to Integrating XML and Web Services ...
- **Web Dynpro for Java**:一种基于Java的用户界面开发工具,同样用于构建高度交互式的用户界面,但在Java平台上运行。 #### 实现基于Web Dynpro的门户内容 为了更好地理解如何创建基于Web Dynpro的应用程序并将...