What's ZK"

From Documentation
Line 20: Line 20:
 
:ZK also allows developers to write UI in pure Java (so called Swing-style programming). All components are POJO. The creation, modification and removal are as straightforward as handling POJO objects. In additions, developers are allowed to mix the use of XML and Java to compose UI.
 
:ZK also allows developers to write UI in pure Java (so called Swing-style programming). All components are POJO. The creation, modification and removal are as straightforward as handling POJO objects. In additions, developers are allowed to mix the use of XML and Java to compose UI.
  
===ZK executes java code on the server===
+
===ZK executes Java code on the server===
:You can write event handler of GUI component in java. You can also write business logic in java. All Java code, whether implemented in zscript in ZUML, or in java file, is executed at server side. Therefore, you can fully utilize any java library as you like.
+
:You can write event handler of GUI component in Java. You can also write business logic in Java. All Java code, whether it is embedded in ZUML, or in Java class, is executed at server side. Therefore, you can access all backend servers as you are used to, and fully utilize any Java library as you like.
  
 
===ZK executes all embedded scripting code on the server===
 
===ZK executes all embedded scripting code on the server===

Revision as of 07:44, 3 September 2010

Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


Welcome to ZK, the simplest way to make Rich Web Applications. This chapter describes how ZK works. You may skip this chapter if you prefer to familiarize yourself with the ZK features right away.

ZK: What It Is

ZK is an event-driven, component-based framework to enable rich user interfaces for Web applications. ZK includes an AJAX[1]-based event-driven engine, a rich component set of XUL and XHTML and a markup language called ZUML (ZK User Interface Markup Language).

Similar to desktop applications

With ZK, you represent your application's GUI in feature-rich XUL and XHTML components and manipulate them upon events triggered by user's activity. The synchronization of component content and the pipelining of events are done automatically by the ZK engine.
Your users get the same engaging interactivity and responsiveness of the desktop application, while your development retains the simplicity of developing desktop applications.
ZK handles browser compatibility issues for developers. You don't have to write javascript to handle it anymore. Write once, run in every browser.

XML based GUI

ZK supports a markup language called ZUML. ZUML, like XHTML, enables developers to design user interfaces without programming. With XML namespaces, ZUML seamlessly integrates different set of tags[2] into the same page. Currently ZUML supports two set of tags, XUL and HTML.

Pure Java based GUI

ZK also allows developers to write UI in pure Java (so called Swing-style programming). All components are POJO. The creation, modification and removal are as straightforward as handling POJO objects. In additions, developers are allowed to mix the use of XML and Java to compose UI.

ZK executes Java code on the server

You can write event handler of GUI component in Java. You can also write business logic in Java. All Java code, whether it is embedded in ZUML, or in Java class, is executed at server side. Therefore, you can access all backend servers as you are used to, and fully utilize any Java library as you like.

ZK executes all embedded scripting code on the server

For fast prototyping and customization, ZUML allows developers to embed EL expressions, and scripting codes in your favorite languages including but not limited to: Java[3], JavaScript[4], Ruby[5] and Groovy[6]. It's easy to integrate other language interpreter. Then, developer can choose his favorite language. Developers could choose not to embed any scripting codes at all if they prefer a more rigid discipline.

ZK: What It Is Not

Not more than Presentation tier

ZK assumes nothing about persistence or inter-sserver communication. ZK is designed to be as thin as possible. It does not require or suggest any other back-end technologies. All of your favorite middleware technologies such as: JDBC, Hibernate, Java Mail, EJB or JMS work as they used to.

No tunnel, RPC, RMI needed

ZK doesn't provide a tunnel, RPC, RMI or other API for developers to communicate between clients and servers. This is because all code runs at the server within the same JVM.
If using client-side programming, developers could use jQuery or ZK AU requests to communicate with the server directly.

No obligate design pattern

ZK doesn't enforce developers to use MVC or other design patterns. Whether to use them is the developer's choice. Although ZK does provides good support for MVC pattern.

Not limited to XUL

ZK is not a framework aiming to bring XUL to Web applications. It is aimed to bring the desktop programming model to Web applications. Currently, it supports XUL and XHTML, in future it might support XAML, XQuery and others.

Not limited to Ajax

ZK embeds AJAX in the current implementation but it doesn't end in where AJAX does. With ZK API for Mobile devices, your applications could reach any devices that support J2ME such as: PDA, mobiles and game consoles. Moreover, you don't need to modify your application at all[7].

Notes

  1. AJAX is coined by Jesse James Garrett in Ajax: A New Approach to Web Applications.
  2. A tag is an XML element. When a ZUML page is interpreted, a corresponding component is created.
  3. The Java interpreter is based on BeanShell (http://www.beanshell.org).
  4. The JavaScript interpreter is based on Rhino (http://www.mozilla.org/rhino).
  5. The Ruby interpreter is based on JRuby (http://jruby.codehaus.org/).
  6. The Groovy interpreter is based on Groovy (http://groovy.codehaus.org/).
  7. For devices with small screen, you usually have to adjust the presentation pages.

Quiz

  1. Where does ZK execute java code?
  2. ZK has a XML based GUI, what is its name?
  3. What script code does ZK support now?
  4. Where does ZK execute embedded script code? Server or client?
  5. Does ZK need tunnel or RMI? Why?

Refernce



Last Update : 2010/09/03

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.