IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

integrer code javascript avec jsp


Sujet :

JavaScript

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    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 : 5
    Points
    5
    Par défaut integrer code javascript avec jsp
    bonjour à tous,
    je commence par le code:

    Code java : 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
    <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

  2. #2
    Expert confirmé
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Points : 4 164
    Points
    4 164
    Par défaut
    1)

    2) urgent

Discussions similaires

  1. [PHP 5.1] Envoyer un code javascript avec apostrophes
    Par Invité dans le forum Langage
    Réponses: 11
    Dernier message: 14/10/2011, 09h55
  2. code javascript avec mozilla firefox
    Par jesslegende dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 14/02/2011, 15h35
  3. Code javaScript avec IExplorer OU FireFox
    Par fatenatwork dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 12/03/2008, 14h02
  4. Code javaScript avec IExplorer OU FireFox
    Par fatenatwork dans le forum Général JavaScript
    Réponses: 9
    Dernier message: 11/03/2008, 14h50

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo