开发者

Is it possible to call on a Java-method from JavaScript in Java6 1.6 script-engine?

开发者 https://www.devze.com 2023-01-03 05:04 出处:网络
I would like to cal开发者_如何学Cl on an own Java-method from a JavaScript-file via the ScriptEngineManager provided in Java 1.6. Is that possible?Yes: http://www.mozilla.org/rhino/ScriptingJava.html

I would like to cal开发者_如何学Cl on an own Java-method from a JavaScript-file via the ScriptEngineManager provided in Java 1.6. Is that possible?


Yes: http://www.mozilla.org/rhino/ScriptingJava.html

There are many ways of doing it. The Java code can push references to Java objects into the global context, which will look kind-of like what DOM objects look like to browser Javascript. Or Javascript can instantiate Java objects and reference them.

0

精彩评论

暂无评论...
验证码 换一张
取 消