I am trying to access Java class from Js as per mentioned in the JsInterop
documentation, but getting errors like "ReferenceError: com is not defined
at <anonymous>:1:9" or "ReferenceError: Entity is not defined
at <anonymous>:1:9".
Following is my Entity class and when I access it via java file or console
using
var test = new com.test.jsinterop.Entity(1,'test');
it throws the errors.
package com.test.jsinterop;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
@JsType(namespace = JsPackage.GLOBAL)
public class Entity {
public Integer id;
public String name;
public Entity(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
How can I fix this? Can someone explain how this thing really works i.e
calling Java from js using JsInterop.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/c86350fc-1ac2-49f0-8566-ac9e9abd7d58n%40googlegroups.com.