salut a vous. je possède une table géolocalisation dans laquelle j'ai les champs latitude et longitude. j'ai réussi a charger la carte Google Map dans ma page Jsp. mon souci est le suivant :

j'aimerai appeler la fonction javaScript ci-dessous

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
function addMarker(lat, lng, info) {
 
 var pt = new google.maps.LatLng(lat, lng);
 
 bounds.extend(pt);
 
 var marker = new google.maps.Marker({position: pt, icon: icon,map: map});
 
 var popup = new google.maps.InfoWindow({content: info, maxWidth: 300 });
 
 google.maps.event.addListener(marker, "click", function() {
 
 if (currentPopup != null) {
 
 currentPopup.close();
 
 currentPopup = null;
 
 }
 
 popup.open(map, marker);
 
 currentPopup = popup;
 
 });
 
 google.maps.event.addListener(popup, "closeclick", function() {
 
 map.panTo(center);
 
 currentPopup = null;
 
 });
 
 }
dans ma jsp afin de pouvoir afficher un Marker sur la carte Google Map.
voici le code source de ma page JSP.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
 
<head>
 
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
 
<title>Google Map API V3 with markers</title>
 
<style type="text/css">
html {
        height: 100%
}
 
body {
        height: 100%;
        margin: 0;
        padding: 0%
}
 
#map {
        width: 350px;
        height: 100%;
        border: 100px;
        padding: 100px;
}
</style>
 
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false"
	type="text/javascript"></script>
 
<script type="text/javascript">
  
  //Sample code written by August Li
 
 var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",new google.maps.Size(32, 32), new google.maps.Point(0, 0),new google.maps.Point(16, 32));
 
 var center = null;
 
 var map = null;
 
 var currentPopup;
 
 var bounds = new google.maps.LatLngBounds();
 
 function addMarker(lat, lng, info) {
 
 var pt = new google.maps.LatLng(lat, lng);
 
 bounds.extend(pt);
 
 var marker = new google.maps.Marker({position: pt, icon: icon,map: map});
 
 var popup = new google.maps.InfoWindow({content: info, maxWidth: 300 });
 
 google.maps.event.addListener(marker, "click", function() {
 
 if (currentPopup != null) {
 
 currentPopup.close();
 
 currentPopup = null;
 
 }
 
 popup.open(map, marker);
 
 currentPopup = popup;
 
 });
 
 google.maps.event.addListener(popup, "closeclick", function() {
 
 map.panTo(center);
 
 currentPopup = null;
 
 });
 
 }
 
 function initMap() {
 
 map = new google.maps.Map(document.getElementById("map"), {
 
 center: new google.maps.LatLng(0, 0),
 
 zoom: 100,
 
 mapTypeId: google.maps.MapTypeId.ROADMAP,
 
 mapTypeControl: false,
 
 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR},
 
 navigationControl: true,
 
 navigationControlOptions: {
 
 style: google.maps.NavigationControlStyle.SMALL
 
 }
 
 });
 center = bounds.getCenter();
 map.fitBounds(bounds);
 }
 
 
 </script>
</head>
<body onload="initMap()" style="margin: 0px; border: 0px; padding: 0px;">
	<div id="map"></div>
 
	<c:set var="latitude" value="${points.latitude}"   scope="request" />
	<c:set var="longitude" value="${points.longitude}" scope="request" />
 
//c'est ici que j'aimerai appeler cette fonction pour lui passer les variables latitude et longitude afin d'afficher un Marker sur la carte
 
</html>