How I can send Java object from JavaScript to Java? LiveConnect allow us to get Java objects from calling applet method. i.e. we can have following method in applet:
public MyClass getMyClass() { return new MyClass(); }`
where MyClass
is:
public class MyClass implements Serializable {
private String a;
private String b; //getters, setters
}
and in JS access this objects using:
applet.getMyClass().someMethod();
But how I can pass object from JavaScript (json object I think) to java method (not as json string)? i.e. I want to have in applet method like this:
public void myMethod(MyClass var)
and from JavaScript call this method passing parameter of type MyClass
. How to build MyClass
object in JS? I hope LiveConnect do conversion from JSON to Java object automatically..