The Artima Developer Community
Sponsored Link

Java Buzz Forum
DHTML scripting in Java?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Toyokazu Tomatsu

Posts: 66
Nickname: tomatsu
Registered: Jul, 2003

Toyokazu Tomatsu is a developer of Pnuts.
DHTML scripting in Java? Posted: Jun 18, 2006 11:50 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Toyokazu Tomatsu.
Original Post: DHTML scripting in Java?
Feed Title: Pnuts Addict
Feed URL: http://jroller.com/tomatsu/feed/entries/rss
Feed Description: Toyokazu Tomatsu's Weblog
Latest Java Buzz Posts
Latest Java Buzz Posts by Toyokazu Tomatsu
Latest Posts From Pnuts Addict

Advertisement

Ajax was apparently one of the hottest topic in JavaOne 2006. I felt strange that most of the speakers identified Web 2.0 with AJax. Anyway, the conference shed light on some interesting frameworks to generate Javascript code, such as Dojo, GWT, etc.

Back from the conference, I did a trouble-shooting of a financial application implemented as a Java applet. Some problems were related to JVM crash on Windows 98. Java5 printing was also problematic. We had to recommend the customer to implement printing on server side, so that JVM is less likely to crash on various kinds of PCs. The UI is implemented with Swing and Nexaweb, which all could be rewritten with DHTML/Ajax, though we didn't suggest that.

During the trouble shooting, I was wondering if the DHTML/AJax could be written in Java, with a small modification to Java-plugin, because Java has some advantages over JavaScript.

Can access local resources
Java allows you to provide relaxed security restriction under Java2 security.
Better modularity
Why every web apps has to download prototype.js or similar libraries for every request?
Bytecode is more efficient as mobile code
Receiving scripts means that the interpreter has to parse the program every time, which is not efficient.

Java applet is notorious for its slow startup. But if it has no Swing/AWT, I am hoping that the recent development of code sharing would shorten the startup time down to .2 second or even less.

Java plugin has ActiveX-bridge in it, which is usually not visible from application programmers. But if you allow AllPermission to the applet, the ActiveX-bridge can be used directly. So, I did some experiment on that.

  • 1. Put ${user.home}/.java.policy
    	grant {
    		permission java.security.AllPermission;
    	};
    
  • 2. Modified pnuts.tools.PnutsConsoleApplet so that the Applet instance is stored in a context local variable.
    	context.set("pnuts.applet".intern(), this);
    
  • 3. Then, started PnutsConsoleApplet on IE.
    	> document = getContext()["pnuts.applet"].getAppletContext().getJSObject().getMember("document")
    	[object HTMLDocument]
    	> document.call("getElementById", ["test"]).getMember("onclick")
    	function anonymous()
    	{
    	alert()
    	}
    	>
    
    	> document.call("getElementById", ["test"]).getMember("innerHTML")
    	"<INPUT id=test onclick=alert() type=button value=click> "
    

The script above may look ugly, but getMember/setMember(), and call() could be simplified with a configuration. What is really needed is a way to define event handler written in Java. I have no idea so far if it is possible without modification to IE.

Read: DHTML scripting in Java?

Topic: [Jun 12, 2006 12:39 PDT] 10 Links Previous Topic   Next Topic Topic: Parentheses Inspections & Intentions

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use