Storing data from Java to JS' array using JSON

55 views
Skip to first unread message

bob

unread,
Mar 11, 2009, 3:44:53 PM3/11/09
to json-taglib
Currently I have the following code, which for obvious reason, won't
work. However I've tried very hard to get it converted to JSON, but I
don't know how to start, since my objects are in a Vector format. The
following code is what I want to convert to JSON;

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()%>';
}
<%} %>
}

}


Any idea?
Reply all
Reply to author
Forward
0 new messages