Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript
JavaScript Forum programmation JavaScript. Lire : Cours JavaScript, FAQ JavaScript, Toutes les FAQ JavaScript et Sources JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 07/07/2011, 18h13   #1
Invité de passage
 
Homme
Étudiant
Inscription : juillet 2011
Messages : 5
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : juillet 2011
Messages : 5
Points : 0
Points : 0
Par défaut integrer code javascript avec jsp

bonjour à tous,
je commence par le code:

Code java :
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
<f:view>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% ; width:100%;}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
<%!
public LocationSessionBeanRemote account = null;
double Lat;
double Longi;
String id;
double Lat1;
double Longi1;
String id1;
List listeID= new ArrayList();
public void jspInit() {
try {
Context c = new InitialContext();
account= (LocationSessionBeanRemote) c.lookup("java:comp/env/LocationSessionBean");
} catch (NamingException ne) {
// Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
 
}
public void jspDestroy() {
account = null;
}
%>
 
 
<%
List res=(List)request.getAttribute("username");
for (int i=0; i<res.size(); i++)
{
List result=account.businessMethod(res.get(i).toString());
 
Lat=Double.parseDouble(result.get(0).toString());
Longi=Double.parseDouble(result.get(1).toString());
id=res.get(i).toString();
listeID.add(Lat);
listeID.add(Longi);
listeID.add(id);
 
}
 
%>
 
function initialize() {
 
var myLatlng = new google.maps.LatLng( 48.8259198,2.3463068);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
 
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
<% for (int i=1; i<listeID.size(); i++){
Lat1=Double.parseDouble(listeID.get(i).toString());
Longi1=Double.parseDouble(listeID.get(i+1).toString());
id1=res.get(i+2).toString();
 
%>
var type1="<%=Lat1 %>";
var type2="<%=Longi1 %>";
 
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading"></h1>'+
'<div id="bodyContent">'+
'<p><b></b>'+
'<p><a href="http://ubis02-vm1.enst.fr:9090/webGoogleJSP/welcomeJSF.jsp?ID=<%=id1 %>">'+
'Get Profile</a> '+
'</p>'+
'</div>'+
'</div>';
 
 
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: new google.maps.LatLng(type1,type2),
map: map,
title:""
 
});
}
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
<%
 
%>
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
</f:view>

le code javascript permet d'afficher des markeur sur un map google. j'ai une liste listeID qui contient i=latitude , i+1= longitude et i+2= ID
En parcourant cette liste je veux executer le code javascript et afficher ces markeur sur une mm page map

Merci d'avance
sas1986 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/07/2011, 18h49   #2
Expert Confirmé Sénior
 
Avatar de RomainVALERI
 
Homme Romain VALERI
POOête
Inscription : avril 2008
Messages : 2 572
Détails du profil
Informations personnelles :
Nom : Homme Romain VALERI
Âge : 35
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : POOête

Informations forums :
Inscription : avril 2008
Messages : 2 572
Points : 4 074
Points : 4 074
1)

2) urgent
__________________

...pour les linguistes et les curieux >>> générateur de phrases aléatoires

__________________
RomainVALERI est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 04h00.


 
 
 
 
Partenaires

Hébergement Web