Create and Run Your First ZK Application Manually"

From Documentation
(ZK 6)
Line 12: Line 12:
 
==Download ZK Libraries==
 
==Download ZK Libraries==
  
ZK libraries (Now is  ''zk-bin-5.0.4.zip'') can be downloaded from [http://www.zkoss.org/download/zk.dsp ZK Download] and then save it to a proper location.
+
ZK libraries can be downloaded from [http://www.zkoss.org/download/zk.dsp ZK Download] and then save it to a proper location.
  
 
=Create your first application=
 
=Create your first application=

Revision as of 01:41, 3 May 2012


DocumentationZK Installation GuideQuick StartCreate and Run Your First ZK Application Manually
Create and Run Your First ZK Application Manually



Prepare the server

Install Tomcat

First, you have to prepare a Web server. You can use any Web servers that support Java Servlet (2.3 or later). Here we introduce the installation of Tomcat. For other servers and more information, please refer to Setting up Servers.

  1. Visit Tomcat Official Site
  2. Select the correct binary distribution for your environment and download

Download ZK Libraries

ZK libraries can be downloaded from ZK Download and then save it to a proper location.

Create your first application

Here shows you how to create a web application manually without IDE or other tools.

Create Web application

ZK Web Applications use a standard directory structure defined in the Servlet specification.

When developing ZK web applications, you must follow this structure so that the application can be deployed in any J2EE compliant web servers.

All you need to do is create a web application directory with related files. J2EEWebApplication.jpg


  • Now i create one for example named myZK

Install Library Distribution

  1. Unzip zk-bin-5.0.4.zip
  2. Copy JAR files under following list to myZK/WEB-INF/lib
    • {YOUR_ZK_UNZIP_FOLDER}/dist/lib
    • {YOUR_ZK_UNZIP_FOLDER}/dist/lib/ext
    • {YOUR_ZK_UNZIP_FOLDER}/dist/lib/zkforge

Create Deployment Descriptor(Web.xml)

web.xml is called the web application deployment descriptor. This is an XML file that defines servlets, servlet mappings, listeners, filters, welcome files etc.

The deployment descriptor is a heart of any J2EE web applications, so every web application must have a web.xml deployment descriptor directly under WEB-INF folder.

Create First ZUL file

Here is a simple zul file named hello.zul.

 <window title="My First ZK Application" border="normal">
 	Hello World!
 </window>

Pack your project

  1. Compress the myZK directory(e.g. myZK.zip)
  2. Rename myZK.zip to myZK.war
  3. Done!!

Confirm your ZK Web Archive (WAR) file

 myZK.war
 ¦  hello.zul
 ¦  
 - WEB-INF
     ¦  web.xml
     ¦  
     - lib
          *.jar

Version History

Last Update : 2012/05/03


Version Date Content
     



Last Update : 2012/05/03

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