Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8809267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:49:49+00:00 2026-06-14T02:49:49+00:00

Given a list of ‘addresses’ (String) I’m able to get the geocoding (latitude and

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:49:51+00:00Added an answer on June 14, 2026 at 2:49 am

    If the java business code can run in the browser and access all resources it needs from the client browser, you can deploy your java code as an applet: Javascript to Java Applet communication

    Your use case looks more like you want it to run in an application server on a backend server, and let your browser communicate with it via http calls. From JavaScript, this is best done using JavaEE6’s JAX-RS feature, for which Jersey is the reference implementation:
    Access Jersey based RESTful service using jQuery

    In your application server you have:

    class Result{
        public List<Pair<Long,Long>> getList();
        ...
    }
    
    @Path("/coordinates")
    public class CoordinatesResource {
    
        @GET
        @Produces
        public Result getCoordinates(String location){
            return ...;
        }
    }
    

    In the html page, you have something like:

    $.getJSON("http://my.server.com/coordinates/?location=" + location,
      function(json) {
        for(var i = 0; i < json.list.length; i++){
          position = new Microsoft.Maps.Location(json.list[i].left,json.list[i].right);
          var pin = new Microsoft.Maps.Pushpin(position);
          pins.push(pin)
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The original code was somehow complex, i simplify it as: Given: list of class
I am trying to make Java select 1 random string from a given list.
Here is the code on sorting any given list: let rec sort lst =
I have these models: public class StationData { public List<StationToStationModel> Distances { get; set;
Given a class: class Control { public Control Parent { get; set; } public
Given List<T> is considered bad as a base class , and Collection<T> doesn't appear
say your given an instance of List[Class[_ <: Base]] , and say that many
I want to use Stream class in scala to repeat a given list infinitely.
For a given list of People._IDs how can I get the contacts phone number?
I can easily write a predicate to get unique elements from a given list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.