Java to JavaScript communication
I want to access HTML elements from within my Java applet. Like I want to do following:
- Pass a value of text box to applet
- From applet I want to set some text inside an HTML page. Like applet takes some input from text box. Does processing and then print output as
href
on HTML page.
How can i do this?
I heard of some java library: http://java.sun.com/products/plugin/1.3/do开发者_运维知识库cs/jsobject.html.
But where can i download it from?
I think those links take you to the current documentation:
http://docs.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html
https://developer.mozilla.org/en/JavaScript/Guide/LiveConnect_Overview
According to those documents, since Java 1.4 the classes to communicate with Javascript are inlude in the JRE, in lib/plugin.jar
.
You can use Rhinohide. Here's a demo that does exactly what you want Events_2_Demo.
精彩评论