I have a GWT project and I would like to add a script tag to the main html file of the GWT project that calls a Java function located in my client code.
According to the documentation I should add something like the following html tag:
<script type='text/javascript'>
[email protected]::myFunction();
</script>
where com.myCompany.myProject.client.myClass is the class path and myFunction is the java function I would like to call.
When I try this with the following implementation of myFunction nothing happens:
public void myFunction() {
HTMLPanel panel = new HTMLPanel("I have been called");
RootPanel.get().add(panel);
}
That is, myFunction is not being called.
But when I make the same call from a JSNI method, then it works.
Is it maybe not possible to do the call from an html script, or am I doing something wrong?
Thanks!