for multiple Markers only Last Entry of database is showing on Map. how can i add multiple marker on map using this.?

时间:2018-03-25 20:10:04

标签: jsp multidimensional-array maps markers

Here is my code. i have used jsp and mysql with jstl. i also tried using php but same happening.

 function Marker12() {
            var bounds = new google.maps.LatLngBounds();

        var markers = [
           <c:forEach var="row" items="${result.rows}">
                       ['<c:out value="${row.messname}" />',
                         <c:out value="${row.lat}" />,
                         <c:out value="${row.lang}" />,
                       ],
            </c:forEach>   ];  
      //var totmark=[];
var myOptions = {
        zoom: 5,
		center: new google.maps.LatLng(18, 74),
		mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(document.getElementById('map'), myOptions);

                alert(markers[0][1]);
                var i;
                for( i = 0; i < markers.length; i++ ) {
         var position = new google.maps.LatLng(markers[i][1], markers[i][2]);
        bounds.extend(position);
       var marker = new google.maps.Marker({
            position: position,
            map: map,
            title: markers[i][0]});
        
    }      

so what is missing in my script? what is and where is overwritten? i m not getting plz help.

0 个答案:

没有答案