How do I store array of data from Java into JS' array? I've tried the following, but the output is the last row's data (from the DB):

Code:
for (var i=0;i< <%=vec.size()%>;i++){
                 
                    for (var v=0;v<4;v++){
                                     <% for (int m = 0; m < vec.size(); m++) { %>
                                                      if (v==0) { //Store lat
                                                          markers[i][v] = '<%=vec.elementAt(m).getLatitude()%>';
                                                      } else if (v==1){   //Store lng
                                                          markers[i][v] = '<%=vec.elementAt(m).getLongitude()%>';
                                                      } else if (v==2){
                                                          //alert('Marker'+i+v+' value: '+markers[i][v]);
                                                          markers[i][v] = '<%=vec.elementAt(m).getName()%>';

                                                      } else if (v==3){
                                                          markers[i][v] = '<%=vec.elementAt(m).getSpeed()%>';
                                                      }
                                     <%} %>
                                                }

                                            }
The output is always:
markers00 2.944
markers01 101.8742
markers02 owa25
markers03 1.0
markers10 2.944
markers11 101.8742
markers12 owa25
markers13 1.0

The output 00 and 10, 01 and 11, 02 and 22 should have different values...

Any idea?