Question

I'm using Google Maps, now if I click on the image it should call a java method.

infowindowOpts.setContent("<img scr="bla.png"> ");
Was it helpful?

Solution

You can't call java method directly from html.

You can use JavaScript or Jquery for send ajax request to your servlet.
Servlet can call your java method and send JSON response.
again using Jquery(JavaScript) you can update your html code.

OTHER TIPS

A better way is to use GWT JSNI

You can use GWT JSNI to call Java method from JavaScript and vice-verse.

You have to just export you Java method to JavaScript. Now in Java you have full control to do anything.


Find a sample code on Calling GWT Java function from JavaScript

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top