Prepare the server
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.
- Visit Tomcat Official Site
- Select the correct binary distribution for your environment and download
- For Windows, you might download and execute 32-bit/64-bit Windows Service Installer, and then follow the instructions
- For any download/installation problems, please refer to http://tomcat.apache.org/tomcat-6.0-doc/index.html
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.
- Now i create one for example named myZK
Install Library Distribution
- Unzip zk-bin-x.x.x.zip (the x.x.x is the latest version)
- Copy JAR files under following list to myZK/WEB-INF/lib
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.
- For the content of web.xml, please refer to Sample of web.xml for Servlet 3.0, Sample of web.xml for Servlet 2.4 or Sample of web.xml for Servlet 2.3, depending on your Web server support.
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
- Compress the myZK directory(e.g. myZK.zip)
- Rename myZK.zip to myZK.war
Confirm your ZK Web Archive (WAR) file
myZK.war ¦ hello.zul ¦ - WEB-INF ¦ web.xml ¦ - lib *.jar
Last Update : 2012/5/3
|Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.|