So I am doing my first baby-steps in JsInterop, exposing a Java class to javascript, and I can't seem to figure out what I am doing wrong.
Which is understandable, when looking at the implementation generated:
-- My java class looks like this:
@JsExport("poc.Hello")
public class JsHello {
public String sayHello(String name) {
return "Hello " + name;
}
}
And the javascript in my host page like this:
var obj = new poc.Hello();
alert(obj.sayHello("there"));
My browser complains about 'poc' being undefined:
Uncaught ReferenceError: poc is not defined
Which is understandable, when looking at the implementation generated:
_.sayHello_0_g$ = function Cyb_g$(name_0_g$){
return 'Hello ' + name_0_g$;
}
;
var Ldk_bitwerk_client_JsHello_2_classLit_0_g$ = cDb_g$('dk.bitwerk.client', 'JsHello', 428, Ljava_lang_Object_2_classLit_0_g$);
I have tried all sorts of things, such using the real package/class name inside @JsExport, omiting the package/class name inside @JsExport and adding @JsType to the class declaration.
I have also tried annotating a constructor instead of the class.
I am running gwt-2.8.0-snapshot with jsInteropMode=JS, and I have committed the code here: https://github.com/bitwerk/jspoc
Any help will be much appreciated ...
/Brian
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment