title: Calling a GWT Java function from an html script tag
body: <p>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.</p>
  
  <p>According to the <a href="http://www.gwtapps.com/doc/html/com.google.gwt.doc.DeveloperGuide.JavaScriptNativeInterface.JavaFromJavaScript.html" rel="noreferrer">documentation</a> I should add something like the following html tag:</p>
  
  <pre><code>&lt;script type='text/javascript'&gt; 
  this.@com.myCompany.myProject.client.myClass::myFunction();
  &lt;/script&gt;
  </code></pre>
  
  <p>where <em>com.myCompany.myProject.client.myClass</em> is the class path and <em>myFunction</em> is the java function I would like to call.</p>
  
  <p>When I try this with the following implementation of myFunction <strong>nothing</strong> happens:</p>
  
  <pre><code>public void myFunction() {
      HTMLPanel panel = new HTMLPanel("I have been called");
      RootPanel.get().add(panel);
  }
  </code></pre>
  
  <p>That is, <em>myFunction</em> is not being called.</p>
  
  <p>But when I make the same call from a JSNI method, then it works.</p>
  
  <p>Is it maybe not possible to do the call from an html script, or am I doing something wrong?</p>
  
  <p>Thanks!</p>