Overview

jsjavacomm is a Java library which builds on Live Connect to allow very easy intercommunication between Java applets and JavaScript within a web browser. It works by providing a "Java-ish" wrapper around JavaScript objects so you can write Java code within an applet that looks like this:

      	      
JSDOMImplementation domImpl = new JSDOMImplementationImpl();
JSWindow window = domImpl.getWindow(this);
window.alert("Hello World!");		
      	
      

Probably the most useful thing it allows is direct manipulation of the browser's current document's DOM with the standard Java DOM methods; like this:

      	      
JSDOMImplementation domImpl = new JSDOMImplementationImpl();
JSWindow window = domImpl.getWindow(this);
Document document = window.getDocument();
Element element = document.getElementById("myElementsId");
element.getFirstChild().setNodeValue("Hello World!");
      	
      

What's supported

Here's a list of what is currently supported by jsjavacomm (what actually works depends on the underlying JavaScript implementation):

  • DOM Level 3 Core
  • DOM Level 3 Events
  • DOM Level 2 Views
  • SCORM 2004 Runtime API