Rich Internet application using the ZK framework: an open source Ajax framework

Source: Internet
Author: User
Tags xmlns mysql database apache tomcat

ZK is an open source asynchronous JavaScript + XML (Ajax) framework written in Java™ code that allows you to write a rich Internet application that supports WEB 2.0 without writing JavaScript code 。 Typical AJAX frameworks such as Dojo have some JavaScript libraries for exposing certain APIs for "Ajax" calls. ZK, on the other hand, uses an xml-based Wendingyi (meta-definition) to define the user interface. When the client requests this page, the XML is converted to HTML code. This article will introduce you to ZK, using a real-world example to show how it works, which runs on Apache Tomcat and connects to the MySQL database.

Brief introduction

You can consider ZK as Ajax without JavaScript. It contains an Ajax, event-driven engine, a rich set of XHTML and XUL elements, a markup language called ZUML, which is used to create a rich user interface. Business logic can be written and integrated directly into your application through Java code, and is triggered based on events or components. The most powerful feature of ZK is its rich library of controls for user interface development. Funny, huh?

First, I'll describe the previous term in more detail:

XHTML: Extensible Hypertext Markup Language (extensible Hypertext Markup Language), a combination of HTML and XML, combines the power and flexibility of HTML with the scalability of XML. Listing 1 provides an example of an XHTML code.

Listing 1. XHTML code Example

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <title>Hello ZK</title>
    <body>
    </body>
 

The Xul:xml user interface language (XML User Interface Language), referred to as XUL (pronounced with "zool"), is a markup language developed by Mozilla, an XML application that describes the graphical user interface. XUL can create a variety of elements, such as input controls, toolbars, menus, tree charts, keyboard shortcuts, and more. Listing 2 shows an example of a XUL code.

Listing 2. XUL code Example

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"? >
<window id="main" title="My App" width="300" height="300"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"& gt;
   <caption label="Hello World"/>
   </window>

The ZUML:ZK User Interface Markup Language (ZK user Interface Markup Language) is used to define the rich user interface. Because it is based on XML, each element describes the component, and the attribute describes the component value. Listing 3 shows an example of a ZUML code.

Listing 3. ZUML code Example

<window title="Hello ZUML" border="normal">
   Hello World!
  </window>

Get ZK

Getting and installing ZK is very simple. The ZK document Web site contains a large number of documents about libraries and how to create a folder structure. Therefore, getting ZK (including running the Hello World application) should be very simple.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.