ZK (framework)
File:ZK Sample Components.png | |
Developer(s) | Potix |
---|---|
Stable release | 3.6.0
/ March 2, 2009 |
Repository | |
Operating system | Cross-platform (JVM) |
Type | Ajax Web Framework |
License | GNU General Public License / Commercial |
Website | zkoss.org |
ZK is an open-source Ajax Web application framework, written in Java, [1] [2] [3] [4] that enables creation of rich graphical user interfaces for Web applications with no JavaScript and little programming knowledge.
The core of ZK consists of an Ajax-based event-driven mechanism, over 123 XUL and 83 XHTML-based components [5] , and a markup language for designing user interfaces. Programmers design their application pages in feature-rich XUL/XHTML components, and manipulate them upon events triggered by end user's activity. It is similar to the programming model found in desktop GUI-based applications.
ZK takes the so called server-centric approach that the content synchronization of components and the event pipelining between clients and servers are automatically done by the engine and Ajax plumbing codes are completely transparent to web application developers. Therefore, the end users get the similar engaged interactivity and responsiveness as a desktop application, while programmers' development retains a similar simplicity to that of desktop applications.
In addition to component-based programming in a manner similar to Swing, ZK supports a markup language for rich user interface definition called ZUML.
- ZUML is designed for non-programmer developers to design user interfaces intuitively.
- ZUML allows developer to meld different markup languages, such as Mozilla XUL language and XHTML, seamlessly into the same page.
- ZUML allows developers to embed script in pure Java language (interpreted by BeanShell) and use EL expressions to manipulate the components and access data.
Features
- Declarative high level specification of rich (rather than plain HTML) user interfaces. For example the XUL widget set includes support for trees, comboboxes, bandboxes and sliders [1].
- Embedding scripting support with Java (Beanshell [2]). This is an important benefit as you can use a unified programming language for both user interface and backend programming. Optional support for other serverside Java scripting in other languages such as JavaScript (Rhino [3]), Ruby (JRuby [4]), Python (Jython [5]) and Groovy [6]
- High level Ajax support. User input passes from the browser to the serverside desktop model over Ajax.
- Event-driven component-based model (similar to desktop programming models)
- Support for creating user interfaces using different patterns. A MVC programming approach can be adopted with all events forwarded to a central controller class [7]. Alternatively event handlers can be defined within the page using zscript [8]. The MVC page approach is analogous to Swing programming and the in-page approach is analogous to DHTML programming on the server.
- Support for integrating with existing web frameworks via a JSP custom tag library, JSF support and a Servlet Filter. Has support for Spring and Hibernate.
- Extensible in that programmers that can create new custom UI controls. Groups of controls can be re-used as a macro component.
- Databinding capability via in-page annotations that transparently bind screen controls to the fields of POJOs on the server.
Differences to XUL
- ZK is a server side framework which emits HTML and thus does not depend on client side presence of Gecko making it portable to any browser. ZK takes ZUML (xul and xhtml) serverside pages as input and outputs dhtml for the browser.
- ZK processes user interface logic on the server in Java. This increases choice in the scripting engines and application libraries that can be used to create logic. Presentation effects can be delegated to the browser using the Client-side Actions feature to reduce server load for dhtml effects. Running the application logic on the server in a single application container reduces the amount of cross browser and browser version testing when compared to extensively programming the DOM at the browser.
- While ZK and XUL have an overlapping subset of components ZK has their own unique component sets. The component library can be extended with custom components. Macro components can be defined that are composites of components.
- ZK provides serverside databinding annotations to declaratively bind UI components to serverside data.
- Look and Feel differences.
System requirements
Prerequisites of programming skills
Required
- Basic knowledge of Java or a Java scripting engine language such as Groovy (Java JavaScript), Rhino, JRuby (Java Ruby) or Jython (Java Python)
- Basic knowledge of HTML and XUL
Optional
- Knowledge of a scripting language to write the glue logic (running on the server):
- BeanShell (Java interpreter), JavaScript, Groovy, Ruby, and Python currently supported.
- Object Oriented Programming. You can choose to do AWT/Swing style programming against the ZK API. You can choose to program one or more custom UI controller classes in Java. This is entirely optional. Alternatively you can choose to use zscript script tags for user interface logic which is similar to dhtml programming.
- Servlet Programming. ZK is built on top of the Servlet API. You can choose to do regular Servlet programming and use ZUML as the page language.
- Ajax. ZK is built on top of Ajax but it automatically converts user input at the browser to Java events at the server so you do not have to either program nor understand browser Ajax.
- JavaScript (on the client side). You can choose to use client side actions on your components for performing dhtml logic but most user interfaces do not require this.
- Declarative Databindings. ZK has an optional syntax for binding user interface controls to your POJO Java Beans. ZK will automatically call your POJO setter/getter methods with zero programming in response to use input at the browser.
- EL language. ZK supports JSTL style EL.
ZUML
ZUML (ZK User Interface Markup Language) is a markup language for rich user interfaces definition.
- ZUML is designed for non-programmers to design user interfaces efficiently with the ZUML markup
- ZUML allows developer to meld different markup languages, such as Mozilla XUL language and XHTML, seamlessly into the same page.
- ZUML allows developers to embed script in pure Java language (interpreted by BeanShell) and use EL expressions to manipulate the components and access data.
- ZUML is supported by ZK.
See Also
- Books
- ZK - Ajax without JavaScript published by Apress.
- ZK Developer's Guide published by Packt.
- Articles
- Next-Generation Applications Using Ajax and OpenAjax at OpenAjax Alliance
- Zero-code AJAX framework sought at InfoWorld.
- Designing rich AJAX Web interfaces with ZK at Linux.com
- AJAX, DHTML and JavaScript Libraries at Smashing Magazine
- ZK and Agile at TheServerSide
- The ZK Framework at Dr.Dobb's Poral
- ZK - AJAX without the JavaScript at IBM Developer's Works
- Ajax with the ZK Framework at deverloper.com
- ZK Ajax Java Web Framework: Ajax with no Javascript at infoQ.com
- Using Desktop MVC Patterns with ZK, Spring & JPA;
- Implementing Load-on-Demand using ZK and Grails
References
- ^ Chen, Henri (2008). ZK - Ajax without JavaScript. Apress. p. 125. ISBN 978-1590599013.
- ^ Staeuble, Markus (2008). ZK Developer's Guide. Packt Publishing. p. 184. ISBN 978-1847192004.
- ^ Van der Schyff, Andre (2009-03-31). "A look at MVC frameworks". ITWeb. Retrieved 2009-04-14.
MVC frameworks provide limited functionality when compared to ZK, Echo and other Java Web frameworks.
- ^ "ZK 2.0: AJAX ohne Javascript-Arbeiten". 2006-06-13. Retrieved 2009-04-14.
- ^ {{cite web | title = ZK Explorer | url = http://www.zkoss.org/zkdemo/userguide/ | accessdate = 2009-05-11