Activate your free membership today | Log-in

Monday, February 19th, 2007

ZK Now Supports Javascript, Groovy, Ruby

Category: Framework, Java, JavaScript, Ruby

<p>As promised, the latest release of ZK (ZK 2.3 RC) now supports more languages in zscript than just Java. It now supports Javascript, Groovy and Ruby. Futhermore, you can easily add support for a new language in half a day (maybe with some practice, no?) by extending a simple interpreter class. That's assuming, of course, that a Java-based interpreter already exists for the language.

For those of you not familiar with ZK, it is a Ajax framework that has you write your application logic on the server-side and treats the browser as a simple display server (as opposed to client-side frameworks that implement lots of application logic in the browser and treat the server more as a collection of web services). You write your application using ZUML, an XML-based markup language, assembling interface components in a way very similar to the desktop GUI component/event driven model. You tie your app logic into the markup language using zscript statements:

CODE:
  1. <window title="Fileupload Demo" border="normal">
  2.     <image id="image"/>
  3.     <button label="Upload">
  4.         <attribute name="onClick">{
  5.             Object media = Fileupload.get();
  6.             if (media instanceof org.zkoss.image.Image)
  7.                 image.setContent(media);
  8.             else if (media != null)
  9.                 Messagebox.show("Not an image: "+media, "Error",
  10.                     Messagebox.OK, Messagebox.ERROR);
  11.         }</attribute>
  12.     </button>
  13. </window>

In the sample above, we are using Java as the scripting language. Now you can use Ruby, Javascript or Groovy in it's place. Realize that scripts written in these languages are executed on the server, not the browser.

Related Content:

  • Groovy programming on IBM i
    Groovy programs, based on the Java language and bytecodes, can run on IBM i. The built-in AIX support, PASE, allows AS/400 shops to take advantage of...
  • Web services with Ruby on Rails
    The Ruby on Rails framework has added REST support, making it a Web service alternative to SOAP stack...
  • Groovy: First Contact
    Tired of coding in Java? Learn the benefits and advantages of using Groovy and enjoy coding much...
  • Running Groovy, PHP on IBM JVM
    One of the most vibrant trends in Java in recent years has been the growth of support for non-Java languages on the JVM. PHP, Groovy, Ruby – these...
  • Microsoft supports Ruby, Python
    Microsoft expands the languages it supports in Silverlight, formerly known as Windows Presentation Foundation/Everywhere to includes Ruby and Python....

Posted by Dietrich Kappe at 9:30 am
Comment here

+++--
3.9 rating from 39 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.