jsni

GWT JSNI - problem passing Strings

点点圈 提交于 2019-11-27 03:34:58
问题 I'm trying to provide some function hooks in my GWT project: private TextBox hello = new TextBox(); private void helloMethod(String from) { hello.setText(from); } private native void publish() /*-{ $wnd.setText = $entry(this.@com.example.my.Class::helloMethod(Ljava/lang/String;)); }-*/; publish() being called in onModuleLoad() . But this doesn't work, providing no feedback as to why in the dev console. I've also tried: private native void publish() /*-{ $wnd.setText = function(from) { alert

How to call GWT java function from Javascript?

北城以北 提交于 2019-11-27 03:25:54
问题 Is it possible to call Java (GWT) methods from Javascript? It is also unclear from documentation. All samples here http://code.google.com/intl/ru/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html demonstrate calling java functions from JSNI (not JS) functions. UPDATE 1 Here is a Java code: public class Test_GoogleWeb_JSNI_02 implements EntryPoint { /** * This is the entry point method. */ public void onModuleLoad() { } public static void Callee() { Window.alert("Callee"); } } Here is caller