Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home Frameworks ZK Framework
 

ZK-Framework - Setting up a New Project

 

Read from beginning sample Chapter 2 - Online Media Library
ZK-Framework - Online Media Library
ZK-Framework - Setting up Eclipse to Develop with ZK


Setting up a New Project


The first thing we will need for the project is the framework itself. You can download the ZK framework from http://www.zkoss.org" target="_blank" rel="nofollow". At the time of writing, the latest version of ZK is 2.3.0. Therefore it's recommended to use that version for the examples that are provided in this book.



After downloading and unzipping the ZK framework we should define a project structure. A good structure for the project is the directory layout from the Maven project (http://maven.apache.org/). The structure is shown in the figure below.



The directory lib contains the libraries of the ZK framework. For the first time it's wise to copy all JAR files from the ZK framework distribution. If you unzip the distribution of the version 2.3.0 the structure should look like the figure below. The structure below shows the structure of the ZK distribution. Here you can get the files you need for your own application.



For our example, you should copy all JAR files from lib, ext, and zkforge to the WEB-INF/lib directory of your application. It's important that the libraries from ext and zkforge are copied direct to WEB-INF/lib. Additionally copy the directories tld and xsd to the WEB-INF directory of your application.


Now after the copy process, we have to create the deployment descriptor (web.xml) for the web application. Here you can use web.xml from the demo application, which is provided from the ZK framework. For our first steps, we need no zk.xml(that configuration file is optional in a ZK application).


The applica tion itself must be run inside a JEE (Java Enterprise Edition) Webcontainer. For our ex ample, we used the Tomcat container from the Apache project (http://tomcat.apache.org). However, you can run the application in each JEE container that follows the Java Servlet Specification 2.4 (or higher) and runs under a Java Virtual Machine 1.4 (or higher). We create the zk-media.xml fi le for Tomcat, which is placed in conf/Catalina/localhostof the Tomcat directory.


Sample Code
  1. <context reloadable="true" privileged="true" debug="0" path="/zk-media" docbase="D:/Development/workspaces/
  2. workspace-zk-medialib/ZK-Medialib/src/main/webapp" crosscontext="false"></context> <logger timestamp="true" suffix=".txt" prefix="zkmedia-" directory="D:/Development/
  3. workspaces/workspace-zk-medialib/logs/ZK-Medialib" classname="org.apache.catalina.logger.FileLogger"></logger>
Copyright ajaxwith.com



With the help of this context file, we can directly see the changes of our development, since, we set the root of the web application to the development directory.


Deployment of the demo application


The folder structure of the demo application is the Maven structure (http://maven.apache.org/). To deploy the application, create a new subdirectory (e.g. zk-media-lib) in the webapps directory of Tomcat and copy everything from the webapp directory of the application to this new subdirectory. Don't forget to copy the libraries, too. After that, you can start your Tomcat and run the application with http://localhost:8080/zk-media-lib(if your Tomcat is running on port 8080).




Read More from sample Chapter 2 - Online Media Library
ZK-Framework - Ceating the Pages



Read Next: ZK-Framework - Creating the Pages



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links