ZK for eclipse

Source: Internet
Author: User
Tags tld

ZK is an excellent Ajax framework called "ajax framework without JavaScript". It is somewhat like the implementation of GWT, but unlike the full desktop development idea of GWT, it supports the use of Zul, a zk Interface script to write the interface, the development efficiency is very high, the interface is also very beautiful, specific introduction can go to see it home: http://www.zkoss.org. However, it is a pity that ZK does not have Eclipse plug-ins yet. However, using tools provided by myeclipse, we can create a satisfactory development environment, this article introduces how to create this environment. The environment in this article is jdk6.o + eclipse3.3 + myeclipse6.0m + zk2.4.1.

First of all, go to the http://www.zkoss.org to download the latest version of ZK, is currently 2.4.1, download the development kit and demo, download the development package ZK development library, as well as the library used, there are some extension library, in addition, it is the source code of ZK. The Dist directory structure under the Development Kit is as follows:

├ ── Lib
│ Zcommon. Jar
│ Zhtml. Jar
│ Zk. Jar
│ Zkplus. Jar
│ Zul. Jar
│ Zweb. Jar

│ Audio-ext
│ Bsh. Jar
│ Commons-el.jar.
│ Commons-fileupload.jar.
│ Commons-io.jar.
│ Filters. Jar
│ Groovy. Jar
│ Jcommon. Jar
│ Jfreechart. Jar
│ Jruby. Jar
│ Js. Jar

│ Sampled-zkforge
│ Dojoz. Jar
│ Fckez. Jar
│ Gmapsz. Jar
│ Json_simple.jar
│ Timelinez. Jar

├ ── SRC
│ Zcommon-sources.jar.
│ Zhtml-sources.jar.
│ Zk-sources.jar.
│ Zkplus-sources.jar.
│ Zul-sources.jar.
│ Zweb-sources.jar.

├-WEB-INF
│ ─ ── TLD
│ ─ ── Web
│ Core. DSP. TLD
│ Html. DSP. TLD

│ ─ ── ZK
│ Core. DSP. TLD

│ ─ ── Zul
│ Core. DSP. TLD

└ ── XSD
Zul. XSD

Copy all the files in this directory to a dedicated directory (I usually like to put the third-party libraries that are frequently used in a dedicated folder, and create the corresponding user library in eclipse), for example, I put it under D:/eclipseuserlib/ZK.

Step 2: create a user-defined database. Open Window> preferences> JAVA> build path> User libraries in eclipse, as shown in:

 

 

As shown in, click the new button to create a new user library. Click the created library to activate add jars... button to add jar packages related to this user library. Here we create three user libraries: ZK Ajax frame, ZK Ajax framework extendsion, and ZK Ajax framework forge library, correspond to Lib, ext, and zkforget in the above directory structure respectively.

Another small trick, click the plus sign in front of the jar package, and you can see a source attachment. Double-click it to create a dialog box for you to select the location of the source file, select the corresponding file in the SRC folder in the above directory, so that you can use the code browsing function in eclipse. Step 3: add the XSD to the XML catalog entry. This is to ensure that we can better use the myeclipse XML editor function. Open Window> preferences> myeclipse> files and edtors> XML catalog, as shown in. Click Add to add Zul in the preceding directory in the displayed dialog box. XML to catalog.

Step 4: add your own custom XML to generate the wizard. Open the % myeclipse installation directory %/Eclipse/plugins/COM. genuitec. eclipse. wizards_5.9.100, where templates/XML is used to store the XML file template. here we need to generate the following files: langaddon. VTL
Portlet. VTL
Zk. VTL
Zkweb. VTL
Zul. the first four items of VTL correspond to the WEB-INF, Portlet under zkdemo/webcontent/lang-addon.xml respectively. XML, zk. XML and Web. XML, you only need to copy these files to the XML directory, and modify the file name to the above file name. Note: to open each VTL file, the first line is composed? XML version = "1.0" encoding = "UTF-8"?>" Change to "<? XML version = "1.0" encoding = "$ encoding"?> ". The content of the Zul file is as follows: <? XML version = "1.0" encoding = "$ encoding"?>
<? Page title = "title"?>
<! --
Action. Zul

{Is_note
Purpose:

Description:

History:
Tue Oct 25 09:51:30 2005, created by tomyeh
} Is_note

Copyright (c) 2005 potix Corporation. All rights reserved.

{Is_right
} Is_right
-->
<ZK xmlns = "http://www.zkoss.org/2005/zul"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul">
</ZK> then modify the % myeclipse installation directory %/Eclipse/plugins/COM. genuitec. Eclipse. wizards_5.9.100/templates. XML in <! -- XML templates --> Add the following content: <Template
Context = "com. genuitec. Eclipse. Wizards. xml"
Script = "templates/XML/zkweb. VTL"
Name = "XML template for a web. xml file with ZK Capability"/>
<Template
Context = "com. genuitec. Eclipse. Wizards. xml"
Script = "templates/XML/langaddon. VTL"
Name = "XML template for a lang-addon.xml file for zk"/>
<Template
Context = "com. genuitec. Eclipse. Wizards. xml"
Script = "templates/XML/Portlet. VTL"
Name = "XML template for a port-let.xml file for zk"/>
<Template
Context = "com. genuitec. Eclipse. Wizards. xml"
Script = "templates/XML/ZK. VTL"
Name = "XML template for a zk. xml file"/>
<Template
Context = "com. genuitec. Eclipse. Wizards. xml"
Script = "templates/XML/Zul. VTL" name = "XML template for a *. Zul file"/> Save and re-open eclipse. Step 5: Add a new file type. Open Window-> preferences-> General-content types, as shown in: Add * to Java source file *. zs, add * to XML *. zul, add * to JSP *. DSP, add * to HTML *. zhtml.

Now we have set up a simple but practical ZK development environment in myeclipse. For details about how to use this environment to develop ZK applications, see the article "develop ZK applications using the zk development environment created by myeclipse ".
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.