Given a list of 'addresses' (String) I'm able to get the geocoding (latitude and longitude) in my Java code (Coordination Class).
Armed with the geocoding results my objective is to put the coordinates in an HTML page. Using bing maps, I'm writing something like this:
function GetMap()
{
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("myMap"), {credentials:"MY_KEY_COMES_HERE"});
// Retrieve the location of the map center
var center = map.getCenter();
var pins = new Microsoft.Maps.EntityCollection();
//[PASTE] this code is outputed by my java business code and later copy-paste here
var position = new Microsoft.Maps.Location(21.1833927,-71.147288);
var pin = new Microsoft.Maps.Pushpin(position);
pins.push(pin)
var position = new Microsoft.Maps.Location(21.1822191,-71.182732);
var pin = new Microsoft.Maps.Pushpin(position);
pins.push(pin)
var position = new Microsoft.Maps.Location(22.1188265,-73.1515302);
var pin = new Microsoft.Maps.Pushpin(position);
pins.push(pin)
var position = new Microsoft.Maps.Location(22.1901809,-72.9447259);
var pin = new Microsoft.Maps.Pushpin(position);
pins.push(pin)
var position = new Microsoft.Maps.Location(21.1194505,-71.92582259999999);
var pin = new Microsoft.Maps.Pushpin(position);
pins.push(pin)
//..rest of code comes here
}
The code area inside the javascript is done manually; that is, I'm system.out the code under the word [PASTE]. At this moment, I'm doing it like this just to see that my coordinates are correct (I know, inefficient and dummy).
So that brings me to my question: how can write directly to the HTML page (or javascript) without the manual work described above. Or, how do I combine my java business code with javascript?