Top Banner
PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information. PDF generated at: Tue, 14 Feb 2012 02:02:55 CST ZK Installation Guide For ZK 6
96

ZK 6 Installation Guide

Oct 22, 2014

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

ZK Installation GuideFor ZK 6

PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information. PDF generated at: Tue, 14 Feb 2012 02:02:55 CST

ContentsArticlesZK Installation Guide Before You Start New to Java New to Java Servlet Quick Start Create and Run Your First ZK Application with Eclipse and ZK Studio Create and Run Your First ZK Application with NetBeans and REM Create and Run Your First ZK Application Manually ZK Background Sample of web.xml for Servlet 3.0 Sample of web.xml for Servlet 2.4 Sample of web.xml for Servlet 2.3 The Content of ZK Binary Distribution Setting up Servers Tomcat JBoss WebSphere Oracle Server WebLogic WebLogic Portal WebLogic Cluster Google App Engine Liferay Pluto Jetty Resin Setting up OS Linux IOS Setting up IDE Eclipse with ZK Studio Eclipse without ZK Studio Maven Setting up Maven on IDE 1 1 1 2 3 3 9 13 15 15 16 18 19 22 22 23 24 28 29 30 35 36 40 54 57 57 58 58 59 60 60 61 63 64

Use ZK Maven Archetype Create and Run ZK Application with Maven Archetype Create and Run ZK Application with Maven Use ZK Maven Repository without IDE XML Editor

66 68 75 81 90

ReferencesArticle Sources and Contributors Image Sources, Licenses and Contributors 91 92

ZK Installation Guide

1

ZK Installation GuideDocumentation:Books/ZK_Installation_Guide ZK_Installation_Guide http:/ / books. zkoss. org/ wiki/

Before You StartBefore developing a Web application in Java, you have to install Java Development Kit (JDK) and a Servlet container. Here we will guide you through the installation of JDK and the content of ZK binary distribution.

New to JavaYou don't need to know Java to use ZK, since all rich user interfaces can be implemented in a HTML-like markup language called ZUML. However, to complete a Web application, you or your teammates need to write some Java code to glue UI and services together. It requires some Java knowledge. If you haven't installed the following applications on your computer, please download and install them first. Java SE Development Kit (JDK) JDK is a software development for writing application in Java. Note : we suggest you install this first even some web server already contains one Web Server A Web servlet is used to host the Web application you developed ZK Framework ZK is an Ajax framework simplifying the development of Web applications

Java TutorialsHere are some good Java tutorials.Java Language Basic URLs [1] [1]

Class and Object [2] [2] [3] [3] [4] [4]

New to Java

2

Install Java SE Development KitZK supports JDK[5] 1.4, 5, and 6. You could visit the Java website to download and install the version you want. JDK 6 Download: http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html Installation Instructions: http://www.oracle.com/technetwork/java/javase/index-137561.html JDK 5 Download: http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html Installation Instructions: http://java.sun.com/j2se/1.5.0/install.html[1] [2] [3] [4] [5] http:/ / java. sun. com/ docs/ books/ tutorial/ java/ nutsandbolts/ index. html http:/ / java. sun. com/ docs/ books/ tutorial/ java/ concepts/ index. html http:/ / java. sun. com/ docs/ books/ tutorial/ java/ javaOO/ index. html http:/ / java. sun. com/ docs/ books/ tutorial/ java/ IandI/ index. html Java SE Development Kit

Version HistoryVersion Date Content

New to Java ServletYou don't need to know Java Servlet to use ZK, since ZK encapsulates the HTTP requests to higher-level concepts, such as ZUL pages and executions. However, it is helpful if you have some Java Servlet concepts [1].

Java Servlet TuturialsA Web container [2] is a server to serve HTTP requests. A software developer who wants to add dynamical content usually implements a so-called Java Servlet [3]. A Java Servlet [3] is a Java class responsible for processing HTTP requests and then generating the corresponding HTTP response (usually in the format of HTML), based on the requirement of your applications. A Web container is also known as a Servlet container. Tomcat [4] is one of the most famous Web containers. Rich Java [1] offers a good tutorial about Java Servlet.

New to Java Servlet

3

Version HistoryVersion Date Content

References[1] [2] [3] [4] http:/ / richjava. wordpress. com/ http:/ / en. wikipedia. org/ wiki/ Web_container http:/ / www. google. com. tw/ search?q=define:Java+ Servlet http:/ / tomcat. apache. org/

Quick StartThis chapter describes how to quickly start your first ZK application.

Create and Run Your First ZK Application with Eclipse and ZK StudioZK Studio [1] is an Eclipse plugin to simplify the development of ZK applications with Eclipse. If you prefer to install it manually or use with other IDE, please refer to Create and Run Your First ZK Application Manually.

Prepare EclipseInstall Eclipse1. Visit Eclipse download page [2] and download Eclipse IDE for Java EE Developers [3] 2. Uncompress it to a proper directory 3. Then, eclipse is ready to start for use. For example, you could double-click eclipse.exe to start Eclipse under Windows.

PrerequisitesYou can follow ZK Studio Installation Guide before installing ZK Studio: Java SE Development Kit (JDK) Java SE Development Kit version 5 or 6 is required in order to run Eclipse, you can download either of them from the links below: JDK 6 http://java.sun.com/javase/downloads/index.jsp [5] JDK 5 http://java.sun.com/javase/downloads/index_jdk5.jsp [6][4]

to install ZK Studio. There are prerequisites you have to set up

Create and Run Your First ZK Application with Eclipse and ZK Studio For detailed information on JDK installation, please see http:/ / java. sun. com/ javase/ 6/ webnotes/ install/ index. html [7], or http://java.sun.com/j2se/1.5.0/install.html [8] Eclipse IDE for Java EE Developers ZK Studio is an Eclipse Plug-in so you must install Eclipse in advance. The following Eclipse IDE for Java EE Developers packages are recommended: Eclipse v3.6 (Helios) http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/heliossr1 [9] Eclipse v3.5 (Galileo) http://www.eclipse.org/downloads/packages/release/galileo/sr2 [10] Please also see WTP Tutorials Building and Running a Web Application [11] for details. Application Servers Before developing web applications in Java with the ZK Ajax Framework, you need to install an application server. Apache Tomcat is one of the most popular Web containers. Tomcat versions 6 and 7 are compatible with ZK Studio and can be downloaded from the link http://tomcat.apache.org/ [4]. Download the zip file of Tomcat distribution and extract it into a proper location (with no illegal characters or space in the pathname). Tomcat requires configuration before it works with Eclipse, please see ZK Studio Essentials for details.

4

Installing ZK StudioPlease follow the installation guide for your Eclipse version: Eclipse v3.6 (Helios) Installation Guide for Eclipse v3.6 (Helios) Eclipse 3.5 (Galileo) Installation Guide for Eclipse 3.5 (Galileo) Eclipse 3.4 (Ganymede) Installation Guide for Eclipse 3.4 (Ganymede) Eclipse 3.3 (Europa) Installation Guide for Eclipse 3.3 (Europa)

Defining a Server RuntimeBefore deploying and testing your application, you have to install a Web server (such as Tomcat) and specify the server in eclipse. For more information on how to install a server, please also see ZK Installation Guide/Setting up Servers/Tomcat. To specify the server in eclipse, please do as follows. 1. 2. 3. 4. From menu goto Windows > Preferences... Select Server > Runtime Environments, then click Add Select Apache > Apache Tomcat v6.0 and then click Next Browse to and select the root directory of the Web server installed in your computer For example, the root directory of Apache Tomcat might be C:\Program Files\Apache Software Foundation\Tomcat 6.0 For how to install Tomcat, please refer to this section

Create and Run Your First ZK Application with Eclipse and ZK Studio 5. Click Finish

5

Create a "Hello World" application from scratch with ZK SutdioCreate a new "ZK Project"With the release of ZK Studio you no longer have to create a new Dynamic Web Project and configure the settings for ZK! You can create a new ZK Project, choose your ZK Package and sit back while ZK Studio does the rest for you. The following swf demonstrates how to create a new ZK project using Eclipse 3.4 and ZK Studio: Zk_studio_094_new_zk_project.swf For detailed steps, please refer to Create a New ZK Project

Create a new ZUL file1. Right click on the WebContent folder in the Project Explorer view or the Package Explorer view and select New > ZUL.

2. Type test.zul in the File name textbox and click Finish.

Create and Run Your First ZK Application with Eclipse and ZK Studio

6

3. The newly created ZUL File will be opened in the ZUL Editor.

Create and Run Your First ZK Application with Eclipse and ZK Studio

7

Run the application1. Right click on the MyApp project in explorer and in the Menu dialog select Run As > Run on Server

2. Select Apache > Tomcat v6.0 Server in the server type dialog and then click Finish

3. View the result in your browser.

Create and Run Your First ZK Application with Eclipse and ZK Studio

8

Version HistoryVersion Date Content

References[1] http:/ / www. zkoss. org/ product/ zkstudio [2] http:/ / www. eclipse. org/ downloads/ [3] http:/ / www. eclipse. org/ downloads/ download. php?file=/ technology/ epp/ downloads/ release/ ganymede/ SR2/ eclipse-jee-ganymede-SR2-win32. zip [4] http:/ / books. zkoss. org/ wiki/ ZK_Studio_Essentials/ Installation [5] http:/ / java. sun. com/ javase/ downloads/ index. jsp [6] http:/ / java. sun. com/ javase/ downloads/ index_jdk5. jsp [7] http:/ / java. sun. com/ javase/ 6/ webnotes/ install/ index. html [8] http:/ / java. sun. com/ j2se/ 1. 5. 0/ install. html [9] http:/ / www. eclipse. org/ downloads/ packages/ eclipse-ide-java-ee-developers/ heliossr1 [10] http:/ / www. eclipse. org/ downloads/ packages/ release/ galileo/ sr2 [11] http:/ / www. eclipse. org/ webtools/ community/ tutorials/ BuildJ2EEWebApp/ BuildJ2EEWebApp. html

Create and Run Your First ZK Application with NetBeans and REM

9

Create and Run Your First ZK Application with NetBeans and REMREM [1] is a NetBeans module for ZK application development contributed by Mr. Sotohiro Terashima.

Install NetBeans REMInstall NetBeans1. Download the latest NetBeans IDE from here [2] 2. Follow the installation wizard

Install REM plugin1. Download the latest REM plugin from here [3] 2. Start NetBeans 3. On NetBeans' main menu bar, select Tools > Plugins. 4. Click on the "Downloaded" tab, followed by "Add Plugins" to open the file explore

5. Navigate to where REM is downloaded and select the REM plugin

Create and Run Your First ZK Application with NetBeans and REM 6. Click "Install" and follow the NetBeans plugin manager prompts

10

Create a New ZK Project1. On NetBeans main menu bar, select "New Project" 2. On the New Project wizard under "Categories", select "Java Web"

Create and Run Your First ZK Application with NetBeans and REM 3. Confirm and create a new ZK project.

11

4. Select the ZK project folder, and right click "Run" to deploy the project on Glassfish

Create and Run Your First ZK Application with NetBeans and REM

12

Deploy the ZK Demo Project1. On NetBeans main menu bar, select "New Project" 2. On the New Project wizard under "Categories", expand the "Samples" folder and select "Java Web"

3. Select "ZK505 Demo Project" under "Projects" 4. Select the ZK demo project and right click to select "Run" to deploy the ZK demo

Create and Run Your First ZK Application with NetBeans and REM

13

Version HistoryVersion Date Content

References[1] http:/ / rem1. sourceforge. net/ [2] http:/ / www. netbeans. org/ downloads/ index. html [3] http:/ / sourceforge. net/ projects/ rem1/ files/

Create and Run Your First ZK Application ManuallyPrepare the serverInstall TomcatFirst, 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 [1]. For other servers and more information, please refer to Setting up Servers. 1. Visit Tomcat Official Site [4] 2. Select the correct binary distribution for your environment and download For Windows, you might download and execute 32-bit/64-bit Windows Service Installer [2], 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 LibrariesZK libraries (Now is zk-bin-5.0.4.zip) can be downloaded from ZK Download location.[3]

and then save it to a proper

Create your first applicationHere shows you how to create a web application manually without IDE or other tools.

Create Web applicationZK 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. Now i create one for example named myZK

Create and Run Your First ZK Application Manually

14

Install Library Distribution1. 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. 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 fileHere is a simple zul file named hello.zul. Hello World!

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

Confirm your ZK Web Archive (WAR) filemyZK.war hello.zul - WEB-INF web.xml - lib *.jar

Create and Run Your First ZK Application Manually

15

Version HistoryVersion Date Content

References[1] http:/ / tomcat. apache. org [2] http:/ / apache. stu. edu. tw/ / tomcat/ tomcat-6/ v6. 0. 29/ bin/ apache-tomcat-6. 0. 29. exe [3] http:/ / www. zkoss. org/ download/ zk. dsp

ZK BackgroundThis chapter describes the information of ZK installation, such as the sample of web.xml and the content of the binary distribution.

Sample of web.xml for Servlet 3.0ZK 6 supports Servlet 3.0 Pluggability, so you don't have to configure WEB-INF/web.xml at all. My ZK ApplicationMyApp On the other hand, if metadata-complete=true was specified in WEB-INF/web.xml (i.e., the support of pluggability is disabled), you have to configure ZK servlets and listeners manually as described in the Sample of web.xml for Servlet 2.4.

Version HistoryVersion 6.0.0 Date December 2011 Content The support of Servlet 3.0 Pluggability was introduced.

Sample of web.xml for Servlet 2.4

16

Sample of web.xml for Servlet 2.4After the ZK libraries have been deployed to a Web application, we have to configure web.xml to install the required Servlets, listener and mapping: DHtmlLayoutServlet [1], DHtmlUpdateServlet [2], and HttpSessionListener [3]. Here is the sample web.xml for servers that support Servlet 2.4 and later. Notice that if you are using Servlet 3, you generally don't need to set up web.xml unless you'd like to configure it different. Notice that the ZK demo distribution has several web.xml files under the MyApp/WebContent/WEB-INF directory: web.servlet-3.xml (for servers supporting only Servlet 3), web.servlet-2.4.xml (for servers supporting Servlet 2.4 or later), and web.servlet-2.3.xml (for servers supporting only Servlet 2.3). You could copy one of them instead of creating from scratch. My ZK ApplicationMyAppZK listener for session cleanuporg.zkoss.zk.ui.http.HttpSessionListenerZK loader for ZUML pageszkLoaderorg.zkoss.zk.ui.http.DHtmlLayoutServletupdate-uri/zkau1zkLoader*.zulzkLoader*.zhtmlThe asynchronous update engine for ZKauEngineorg.zkoss.zk.au.http.DHtmlUpdateServletauEngine/zkau/*index.zulindex.zhtmlindex.htmlindex.htm

Version HistoryVersion Date Content

References[1] http:/ / www. zkoss. org/ javadoc/ latest/ zk/ org/ zkoss/ zk/ ui/ http/ DHtmlLayoutServlet. html# [2] http:/ / www. zkoss. org/ javadoc/ latest/ zk/ org/ zkoss/ zk/ au/ http/ DHtmlUpdateServlet. html# [3] http:/ / www. zkoss. org/ javadoc/ latest/ zk/ org/ zkoss/ zk/ ui/ http/ HttpSessionListener. html#

Sample of web.xml for Servlet 2.3

18

Sample of web.xml for Servlet 2.3Here is the sample web.xml for servers that support Servlet 2.3 only. Though not necessary, many old servers still requires JDK 1.4. Notice that the ZK demo distribution has two web.xml files under the MyApp/WebContent/WEB-INF directory: web.xml (for servers supporting Servlet 2.4 or later), and web.servlet-2.3.xml (for servers supporting only Servlet 2.3). You could copy one of them instead of creating from scratch. My ZK ApplicationMyApporg.zkoss.zk.ui.http.HttpSessionListener23zkLoaderorg.zkoss.zk.ui.http.DHtmlLayoutServletupdate-uri/zkau1auEngineorg.zkoss.zk.au.http.DHtmlUpdateServletzkLoader*.zulzkLoader*.zhtmlauEngine/zkau/*index.zulindex.zhtmlindex.htmlindex.htm

19

Version HistoryVersion Date Content

The Content of ZK Binary DistributionDirectory StructureThe content of the ZK binary distribution is as follows.

/docThis directory holds the documents including release notes and license.

/dist/dist/libThis directory holds the ZK libraries

The Content of ZK Binary Distribution

20

Filename zcommon.jar ZK's common library (org.zkoss.*) zweb.jar zk.jar zul.jar zhtml.jar zkbind.jar zkplus.jar zel.jar zkex.jar zml.jar zkmax.jar ZK's Web library (org.zkoss.web.* ZK's core (org.zkoss.zk.*) ZUL components (org.zkoss.zul.*)

Description

License LGPL LGPL LGPL LGPL LGPL LGPL LGPL All All All All All All All All

Shipped

ZK HTML (ZHTML) components (org.zkoss.zhtml.*) ZK Bind, including data binding and MVVM. ZK utilities (org.zkoss.zkplus.*)

ZK's implementation of EL 2.2. It is based on Apache Tomcat 7's EL 2.2 implementation. Apache ZK professional ZUL components and utilities (org.zkoss.zkex.*) ZK XML components (org.zkoss.zml.*) ZK enterprise components and utilities (org.zkoss.*)

Commercial ZK PE and EE only Commercial ZK PE and EE only Commercial ZK EE only

/dist/lib/zkforge This directory holds the additional components and libraries. It is optional depending on whether you need them. There are three kinds of binary distributions: CE, PE and EE. If not stated explicitly, it is shipped in all distributions.Filename sapphire.jar silvertail.jar ckez.jar Description Required if you want to use the sapphire theme. Required if you want to use the silvertail theme. Required if you want to use ZK CKeditor component. License Version LGPL LGPL LGPL GPL GPL 6.0.0 6.0.0 3.6.0.1 All All All Shipped

timelinez.jar Required if you want to use ZK Timeline component. timeplotz.jar Required if you want to use ZK Timeplot component. gmapsz.jar zuljsp.jar

2.3.1_50 ZK PE and EE only 1.1_50 2.0.52 2.0 ZK EE only ZK EE only ZK EE only

Required if you want to use ZK Google Maps component. GPL Required if you want to use ZK JSP Tags. GPL

/dist/lib/ext This directory holds the external libraries required to run ZK. Since these libraries are common, you might have already installed them in your Servlet container. These jar files are optional. You can choose whether to copy depending on your requirements.

The Content of ZK Binary Distribution

21

Filename commons-fileupload.jar commons-io.jar

Description Required if you want to upload files with them. Required if you want to use ZUL's chart component.

License Apache

Version Commons Fileupload 1.2.1 Commons IO 1.3.1

Shipped All

jcommon.jar jfreechar.jar

LGPL

JFreeChart 1.0.13 JCommon 1.0.16

ZK PE and EE only

jasperreports.jar Required if you want itext.jarjxl.jar to use the jasperreport poi.jar component. commons-collections.jar commons-logging.jar commons-digester.jar

LGPL (jasperreports)

Jasper Reports 3.7.0(itext: 2.1.7, commons-collections: 3.2.1, commons-logging: 1.1.1, commons-digester: 2.0, jxl: 2.6.12, poi: 3.2) Note: poi.jar is required if you want to use Apache POI to generate Microsoft Excel format. And, jxl.jar is required only if you want to use JExcelApi to generate the Microsoft Excel format.

ZK PE and EE only

bsh.jar

Required if you want scripting in Java interpreter (BeanShell). Required if you want to use the captcha component.

LGPL

BeanShell 2.0b4

All

Filters.jar

Apache

JH Labs Java Image Filters

ZK PE and EE only

The interpreters for Groovy (groovy.jar), Ruby (jruby.jar), Python (jython.jar), JavaScript (js.jar), MVEL (mvel.jar) and OGNL (ognl.jar) are not shipped with the binary distribution since ZK 6. You could get them from their websites, or from ZK's Git repository (https://github.com/zkoss/zk/tree/master/dist/lib/ext).

/dist/srcThis directory holds the source codes in JAR format. These JAR files are used for debugging in IDE, such as Eclipse and NetBeans. You cannot build the binary libraries from these. Rather, download and uncompress zk-src-6.0.0.tar.gz.

/dist/xsdThis directory holds the XSD files that might be useful to develop ZK applications.

/dist/WEB-INFThis directory holds the sample configuration file (web.xml and portlet.xml) and the TLD files. These TLD files are part of JAR files so they are loaded automatically. We put them here mainly for your reference only.

Version HistoryVersion Date Content

Setting up Servers

22

Setting up ServersIf you are new to Web servers, you could start with ZK Installation Guide/Setting up Servers/Tomcat.

TomcatInstall Tomcat1. Visit Tomcat Official Site [4] 2. Select the correct binary distribution for your environment and download For Windows, you might download and execute 32-bit/64-bit Windows Service Installer [2], and then follow the instructions Any download/install problem, please refer to http://tomcat.apache.org/tomcat-6.0-doc/index.html

DeployDeploy ZK demo application(optional)The simplest way to test drive ZK existed application is to download and install the ZK demo application. This step is optional. You could skip it if you prefer to start creating your own application directly. 1. 2. 3. 4. 5. Download the lastest zkdemo at http://sourceforge.net/projects/zk1/files/ZK/(e.g. zk-demo-5.0.4.zip) Unzip zk-demo-5.0.4.zip Copy zkdemo.war under the zk-demo-5.0.4 directory to $TOMCAT_HOME/webapps. Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.) Visit http://localhost:8080/zkdemo, and then play around with the demo application Deploy war file to Tomcat is very easy but there're something you need to know Tomcat will unzip the war file to filename\ directory automatically You can NOT modify the content of filename\ directory unless you remove the war file, or your modification will not work. For more information about Tomcat's deployer, please refer to http://tomcat.apache.org/tomcat-6.0-doc/ deployer-howto.html

Tomcat

23

Deploy your application with IDEWhen developing an application, we usually use IDE to deploy it. For more information, please refer to the document of your IDE. If you are new to Java IDE, you might take a look at Setting up Eclipse with ZK Studio.

Version HistoryVersion Date Content

JBossJBoss 4.0 and above1. 2. 3. 4. 5. 6. 7. Download Jboss from http://www.jboss.com/downloads/index and install it,if you haven't installed it. Test the Jboss using link http://localhost:port, if it's OK stop the server. Unzip zk-demo-XXX.zip or zk-demo-XXX.tar.gz Copy dist/lib/*.jar and dist/lib/*/*.jar to the $JBOSS_HOME/server/default/lib Copy zkdemo.war to $JBOSS_HOME/server/default/deploy Start the server. Browse to http://localhost/zkdemo/userguide or http://localhost:8080/zkdemo/userguide depending on you configuration for JBoss.

by Juan Jose Buendia Mardones (Chile)

JBoss 3.2.2 + tomcat 4.11. Follow the instruction to install ZK Ajax on tomcat 4.1. 2. Download the following files and copy them to the lib directory under default. bsh-bsf-2.0b4.jar bsh-core-2.0b4.jar bsh-2.0b2.jar 3. Change the web.xml so that it will fit servlet 2.3 specifications. 4. We are still working on some problems and I will update this record when I'll have the full solution. When I tried the solution given by Mars Chen some of the components built upon the Jboss platform didn't function anymore. When doing my solution however one of the ZK components (the upload file) didn't work. But for now I did a workaround to use tomcat 5.5 in the background. by Yaniv Ran (USA) 2.1 There I got another simple solution: using ZK distribution's bsh.jar into JBoss lib directory to replace bsh-core-version.jar. Please refer BeanShell official site. == http:/ / www. beanshell. org/ download. html == The bsh-version.jar containas all files in bsh-core-version.jar. by Mars Chen (Taiwan)

JBoss

24

Version HistoryVersion Date Content

WebSphereIBM WebSphere1. IBM offers a websphere application server community edition. Please go to http://www-128.ibm.com/ developerworks/downloads/ws/wasce/?S_TACT=105AGX10&S_CMP=WASCE to download it. 2. Follow the instruction to download, you might need to register for an account if you don't already have one. 3. Under downloads, choose Server and 32bit IBM SDK 1.4.2 SR4-1, procees to download. 4. Start the installer and accepts all defaults. 5. Once installation is completed, go to All Programs->IBM Websphere->Application Server->Profiles->Default->Start the Server, this will start the server. 6. Browse http://localhost:9060/ibm/console/secure/logon.do to deploy application 7. After deployed, applications can be access via http://localhost:9080/myapp 8. For additional documentation and tutorials, go to http://publib.boulder.ibm.com/wasce/Front_en.html ZK supports Servlet 2.3, 2.4 and later. The only difference is the content of WEB-INF/web.xml is a little bit different. Please refer to Sample of web.xml and Sample of web.xml for Servlet 2.3.

IBM WebSphere 7Import war file 1. Applications -> Application Types -> WebSphere enterprise applications -> Click install button

2.

Select

war

file

to

import

WebSphere

25

3. Select Fast Pa Find web application port 1. Servers -> Server Types -> WebSphere application servers -> Click "server1"

2.

Communcations

->

Click

on

"Ports"

WebSphere

26

3.

WebSphere View Web application

27

Version HistoryVersion Date Content

Oracle Server

28

Oracle ServerOracle OC4J and Oracle OPMN Release 3OC4J 10.1.3 (release 3) is the first production version of Oracle Containers For Java to support J2EE 1.4 specification (Servlet 2.4). 1. Download OC4J 10.1.3 or later from http://www.oracle.com and install it. 2. You must setup OC4J to run with the -userThreads parameter at the command line (oc4j.cmd, on OPMN this is done inside the opmn.xml ) 3. Unzip zk-1.2.0-2006-04-07.zip or later version 4. Copy dist/lib/*.jar and dist/lib/ext/*.jar to the $OC4J_HOME/j2ee/home/applib 5. Start OC4J server and enter a new oc4jadmin's password if prompted or restart the server if it is already up 6. Open "Enterprise Manager" application - just browse to http://localhost:8888/em/ 7. Login as oc4jadmin and go to Applications --> Deploy page 8. Deploy zkdemo.war (follow the on-screen instructions) 9. Browse to http://localhost:8888/zkdemo/userguide Substitute "/zkdemo" with the context uri you entered in EM during deployment Start OC4J Server: bin/oc4j -start

10.1.2 and earlierPrior versions 10.1.2.0.2, 10.1.2.0.1 supports only J2EE 1.3 (with Servlet 2.3), WEB-INF/web.xml shall be replaced with Sample of web.xml for Servlet 2.3. Notice that ZK supports Servlet 2.3 (and even JDK 1.4) but the web.xml configuration file is a bit different.

Version HistoryVersion Date Content

WebLogic

29

WebLogic1. Download Weblogic 9.1 from [1] 2. Start the Weblogic installer and accept all defaults. 3. Once the default installation is complete, create a weblogic domain by clicking Start->Programs->BEA products->Tools->Configuration Wizard. 4. Select "Create New Weblogic Domain" and click Next. 5. Accept the defaults on "Select Domain Source" and click Next. 6. Enter a password in "Configure Administrator Username and Password" and click Next. 7. Accept all defaults on "Configure Server Start Mode and JDK" and click Next. 8. Selct No on Configure Environment Setting and Services" and click Next. 9. Accept all defaults on "Create Weblogic Domain and click Create. 10. Once the domain is created, check the check box labeled "Start Admin Server" and click Done. 11. The server will start up. 12. The HTTP port is default to 7001 unless you change it. The easiest way to deploy your application is to copy your war/ear (it could be in an exploded format) to the autodeploy directory under the weblogic installaton directory. If you followed the instruction above that directory is located at C:\bea\user_projects\domains\base_domain\autodeploy. When you place your war/ear file in that directory, weblogic will detect it and do a hot deployment. If you want to copy ZK libraries to the domain, put them under c:/bea/user_projects/domains/base_domain/lib Libraries that have to be copied include bsh.jar, commons-fileupload.jar, commons-el.jar, pxcommon.jar, pxweb.jar, zk.jar, zul.jar, and zhtml.jar.

Version HistoryVersion Date Content

References[1] http:/ / commerce. bea. com/ showproduct. jsp?family=WLS& major=9. 1& minor=0

WebLogic Portal

30

WebLogic PortalIntroductionWeblogic Portal provides several types of portlets, if you want to convert an existing zul page into a portlet, you can consider using a JSP portlet.

Add JSP/HTML Portlet1. Right click on portlet folder > [New] > [Portlet]

2. Give a file name then click Next.

WebLogic Portal

31

3. Select JSP/HTML Portlet then click Next.

4. Check Minmizable and Maximizable and you can define title and zul page location then click Create.

WebLogic Portal

32

Add Zul page to your webapp Create myZulPage.zul in the WebContent/portlet/myzulpage folder.

WebLogic Portal

33

Add portlet to portal page1. Drag myZulPage.portlet to "Page 1" in the index.portal.

2. Done.

WebLogic Portal

34

Run the weblogic server Run the server and access your application in the following link, http://localhost:7001/myPortalWebProject/ index.portal [1].

Version HistoryVersion Date Content

References[1] http:/ / localhost:7001/ myPortalWebProject/ index. portal

WebLogic Cluster

35

WebLogic ClusterBefore You StartYou have to configure the following setting for ZK and Weblogic.

zk.xml Turn on Serializable UI Factory for ZK, please refer to this documentation. org.zkoss.zk.ui.http.SerializableUiFactoryorg.zkoss.zkplus.cluster.ClusterSessionPatch

weblogic.xml Add a weblogic.xml under XXX/WEB-INF folder(XXX is like ZKsandbox in the war file) For example, PersistentStoreTypereplicated As mentioned in Weblogic's document [1]replicated Same as memory, but session data is replicated across the clustered servers.

WebLogic Cluster

36

Setting up Weblogic ClustersAfter those things done above, please follow the official document to set up a Weblogic Cluster Server here [2].

Version HistoryVersion 5.0.8 Date June 2011 Content Add ClusterSessionPatch listener to zk.xml for enforce Weblogic to write session.

References[1] http:/ / download. oracle. com/ docs/ cd/ E12840_01/ wls/ docs103/ webapp/ weblogic_xml. html#wp1071982 [2] http:/ / download. oracle. com/ docs/ cd/ E12840_01/ wls/ docs103/ cluster/ setup. html

Google App EngineGet Your App Engine Account ReadyFirst, you have to sign up an App Engine website [1] for details.[1]

account and download the App Engine SDK. Refer to the official

To use Google App Engine for Java, you have to take one additional step: sign up here [2]. In addition, your application must be ready for clustering, such as serializable. For more information, please refer to ZK Developer's Reference: Clustering/Programming Tips.

Configure Your App Engine ProjectHere we assume you created a App Engine project. If not, please refer here [3]. There are three files that you have to configure: web.xml, zk.xml and appengine-web.xml. They all reside in the WEB-INF directory.

The web.xml FileThe content is similar to other ZK application except the AU engine has to be mapped to /zkau, too (in additions to /zkau/*. Otherwise, AU requests won't be sent to the AU engine. Here is is an example. ZK listener for session cleanuporg.zkoss.zk.ui.http.HttpSessionListenerzkLoaderorg.zkoss.zk.ui.http.DHtmlLayoutServletupdate-uri/zkau

Google App Engine

37

1auEngineorg.zkoss.zk.au.http.DHtmlUpdateServletzkLoader*.zulauEngine/zkau/*auEngine/zkauindex.zulindex.zhtmlindex.html

The zk.xml FileGoogle App Engine is a cloud service, so you have to enable the clustering: disable event threads and use serializable UI factory. In addition, Google App Engine doesn't allow users to create a working thread, so we have to disable the resend mechanism. Here is an example. org.zkoss.zk.ui.http.SerializableUiFactoryorg.zkoss.zkplus.cluster.ClusterSessionPatchorg.zkoss.util.logging.hierarchy.disabledtrue

Google App Engine

38

-1 With ZK 6 or later, you don't have to specify the library property called org.zkoss.util.logging.hierarchy.disabled. Rather, just not to configure the logging at all (i.e., do not use any feature specified in ZK Developer's Reference/Supporting Utilities/Logger). Then, java.util.logging.LogManager won't be used (which is prohibited by GAE).

The appengine-web.xml FileApp Engine requires one addition configuration file named appengine-web.xml. It resides in the WEB-INF directory. true

More InformationDue to the way App Engine serializes sessions, you have to use ZK 3.6.2 or later. In additions, there are some other limitations. You cannot define functions in zscript, since BeanShell's method can not be serialized correctly[4] . You cannot use captcha due to the limit support of AWT[5][1] [2] [3] [4] http:/ / code. google. com/ appengine/ http:/ / appengine. google. com/ promo/ java_runtime http:/ / code. google. com/ appengine/ docs/ java/ gettingstarted/ It runs correctly locally but not if uploaded. It could be done by specifying as a library property to disable the serializing of zscript methods for the whole application. [5] You will see a warning, ... Component captcha ignored., in the application log.

Memory Limitation and SolutionsGAE limits the session memory to 1 mega bytes. If a user visits several pages (with different URLs) in the same browser session, there would be several desktops created and stored in the session, and it might run out the 1 mega bytes. To avoid this, you can implement DesktopInit (http:/ / www. zkoss. org/ javadoc/ latest/ zk/ org/ zkoss/ zk/ ui/ util/ DesktopInit. html#) to remove other desktops in the desktop cache and specify it in WEB-INF/zk.xml as a listener. For example,

Google App Engine public class MyDesktopInit implements DesktopInit { public void init(Desktop desktop, Object req) throws Exception { HttpServletRequest request = (HttpServletRequest) req; //Remove old Desktop String oldDesktopId = (String) request.getSession().getAttribute("currentDesktopId"); WebAppCtrl ctrl = (WebAppCtrl)Executions.getCurrent().getDesktop().getWebApp(); DesktopCache dc = ctrl.getDesktopCache(desktop.getSession()); dc.removeDesktop(dc.getDesktop(oldDesktopId)); //Add new Desktop request.getSession().setAttribute("currentDesktopId", desktop.getId()); } }

39

SampleDownload (http:/ / sourceforge. net/ projects/ zk1/ files/ ZK for Google App Engine/ ) a sample application named zk-gae. You can visit it at http://zk-gae.appspot.com/hello.zul (http://zk-gae.appspot.com/hello.zul). In additions, you could visit Bitbucket (https:/ / bitbucket. org/ antiso/ zktest/ src/ 143186a3ae8b/ src/ main/ ). It is a sample project developed by Vladimir Sosnin, and the working demo is here (http:/ / tags42. appspot. com/ borderlayout/borderlayout.zul).

Version HistoryVersion 5.0.8 5.0.9 Date June 2011 September 2011 Content Add ClusterSessionPatch listener to zk.xml for enforce GAE to write session. In 5.0.7/5.0.8, we introduced a feature allowing developers to log the serialization. Unfortunately, it broke one of GAE restriction: java.util.logging.LogManager is not accessible. It is fixed in 5.0.9 but specifying a library property called org.zkoss.util.logging.hierarchy.disabled in WEB-INF/zk.xml.

Liferay

40

LiferaySetting up LiferayThere are several ways in which an application can be set up within Liferay, the first one being to simply go to Liferay [1] and download the pre-bundled liferay tomcat bundle (other app server bundles are also available but experiences indicate that other ones might be trickier to begin with as the configuration is usually more lengthy), however, this option is not ideal if the user already have an existing tomcat server. If the user already has a tomcat server on hand and does not particularly feel like deploying another one, the second option would be to download "liferay war". Typically, Liferay's installation removes the ROOT folder from the server, to avoid this situation, please stick to the following steps closely. Download the non-bundled liferay war (Liferay Portal Professional 4.2.1 WAR) from Liferay [1] Download the additional file called Liferay Portal 4.2.1 Dependencies, and unzip it to shared/lib In order to keep the ROOT folder, extract the contents of the war into a folder, call it 'myportal' for instance. Under the WEB-INF folder, create a 'classes' folder, in this folder create a file called 'portal-ext.properties', and in this file place the following (note that users may of course change the portal.ctx and/or the lucene and jackrabbit directory depending on later configurations): portal.release=professional portal.ctx=/myportal auto.deploy.dest.dir=../webapps portal.instances=1 lucene.dir=C:/home/liferay/lucene jcr.jackrabbit.repository.root=C:/home/liferay/jackrabbit omniadmin.users=

Go back to the WEB-INF folder and edit the web.xml - change the root_path to have a param value of '/myportal', so that the top of the web.xml will look as follows:

company_idliferay.comroot_path/myportalAuto Login Filtercom.liferay.portal.servlet.filters.autologin.AutoLoginFilterLiferay . . . Now go into the META-INF folder and add a file called 'context.xml' and add the following (configure this according to own specifics, just make sure that the context path attribute is '/myportal', if the user does not use mysql database and wants liferay to use hSQLdb, strip out the first Resource element): Now for the real trick, liferay 4.2 has a small bug when changing the context to something other than the ROOT. In the folder html/portal, find a file called load_render_portlet.jsp, open the file up and go to line 55-56 and it should look like the following: function loadPortlet() { var path = "/c/portal/render_portlet"; however it should look as follows:

41

Liferay function loadPortlet() { var path = "/myportal/c/portal/render_portlet"; If the user wishes to use mySQL, modify the context.xml to the user's own configurations, the user will also need to download the liferay-mysql script file and run it against the user's database. Now, in the ROOT folder (i.e. C:\ for windows, / for UNIX/LINUX), create a 'home' folder (if it doesn't already exist) and in that folder, create a 'liferay' folder. Make sure tomcat has permission to modify the folder. Now, re zip the folder and rename the zip file to myportal.war, drop it into tomcat's webapps deploy directory and (hopefully) a working liferay portal will appear.

42

Deploying a ZK portletHere, this guide assumes that users are familiar with and have created a ZK war. First, in order to tell liferay about the portlet, create a class that looks like this: /** * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */

Liferay

43

package za.co.mypackage.portlet; import java.io.IOException; import import import import import import import javax.portlet.ActionRequest; javax.portlet.ActionResponse; javax.portlet.GenericPortlet; javax.portlet.PortletException; javax.portlet.PortletRequestDispatcher; javax.portlet.RenderRequest; javax.portlet.RenderResponse;

import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * @author Brian Wing Shun Chan * @modified Glenn Keith */ public class JSPPortlet extends GenericPortlet { public void init() throws PortletException { editJSP = getInitParameter("edit-jsp"); helpJSP = getInitParameter("help-jsp"); viewJSP = getInitParameter("view-jsp"); } public void doDispatch(RenderRequest req, RenderResponse res) throws IOException, PortletException { String jspPage = req.getParameter("jspPage"); if (jspPage != null) { include(jspPage, req, res); } else { super.doDispatch(req, res); } } public void doEdit(RenderRequest req, RenderResponse res) throws IOException, PortletException { if (req.getPreferences() == null) { super.doEdit(req, res); }

Liferay else { include(editJSP, req, res); } } public void doHelp(RenderRequest req, RenderResponse res) throws IOException, PortletException { include(helpJSP, req, res); } public void doView(RenderRequest req, RenderResponse res) throws IOException, PortletException { include(viewJSP, req, res); } protected void include(String path, RenderRequest req, RenderResponse res) throws IOException, PortletException { PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(path); if (prd == null) { _log.error(path + " is not a valid include"); } else { prd.include(req, res); } } protected String editJSP; protected String helpJSP; protected String viewJSP; private static Log _log = LogFactory.getLog(JSPPortlet.class); } Next, create a 'liferay-display.xml' file that looks like the following in WEB-INF:

44

ategory.test">

Liferay Now, also in the WEB-INF, create a file called 'liferay-portlet.xml' that looks like the following:

45

peed-filters-enabled=false" in the liferay-plugin-package.properties file in the WEB-INF directory. Now again in WEB-INF create a 'portlet.xml' file that looks as follows:

portletoneSample JSP Portletza.co.mypackage.JSPPortletview-jsp

Liferay /view.zul0text/htmlSample JSP PortletSample JSP PortletSample JSP Portletguestpower-useruser Note that the /view.zul reference in this file is the 'index' file of the portlet, and all these files have been referenced as 'portletone', please change this as the name of the war file. Finally, at the top of the web.xml file after add the following (followed by the typical ZK stuff): . . .

46

sample-jsp-portletcompany_idliferay.comcom.liferay.portal.kernel.servlet.PortletContextListener . . . Notice that company_id is left as liferay.com.This is because changing the value would also mean digging around the liferay database and it would be hard to find all the places to modify the values. Deploy the resulting war into /home/liferay/deploy directory, Access and sign in to the user's portal, click on 'Add Content' link, under the category 'Test' add 'Sample JSP Portlet'.

Liferay

47

Running ZK 5 with Liferay 5.2Version: Liferay: 5.2.1 and ZK 5 Steps 1.Download Liferay-Tomcat bundle (this example uses liferay-portal-tomcat-6.0-5.2.1) 2.Create a ZK 5 Project 3. Inside the WEB-INF folder, in order to run the ZK application, set up the following four xml files in Liferay. In order to integrate Liferay with ZK, add the following settings to the portlet.xml setting: org.zkoss.zk.ui.http.DHtmlLayoutPortlet And create a zk_page called hello.zul .hello.zul Hello, World! portlet.xml

HelloZKHelloZKHelloZKorg.zkoss.zk.ui.http.DHtmlLayoutPortlet0text/htmlviewenHelloZK PortletHelloZKzkzk_page/hello.zul

Liferay power-useruseradministrator liferay-display.xml

48

ategory.sample"> liferay-portlet.xml

.0" encoding="UTF-8"?> rue">GPL 5.1.1+5.2.1+ 4.Add library-property setting to zk.xml for Liferay Reason: under IE, using Liferay with ZK will cause HTML Parsing Error (KB927917) Solution: use jQueryPatch and set appropriate time delay value for browser. zk.xml . . . org.zkoss.zk.portlet.PageRenderPatch.classorg.zkoss.zkplus.liferay.JQueryRenderPatchorg.zkoss.zkplus.liferary.jQueryPatch500 . . .

49

Liferay 5. Export war file Export a war file called DEPLOY_TO__HelloZK.war, and put this war file under the deploy folder Liferay deploys war files by its name, when the name DEPLOY_TO__HelloZK.war is used, liferay will deploy this war file to folder HelloZK Download DEPLOY_TO__HelloZK.war [2]

50

Running ZK 5 with Liferay 6Version: Liferay: 6.0.4 and ZK 5 Steps 1. Download Liferay version bundled with Tomcat from Liferay [3] 2. Create a ZK 5 Project 3. Inside the WEB-INF folder, in order to run ZK, users need to add four xml files to set up Liferay. JQueryRenderCachedPatch needs to be added to the zk.xml setting The main difference between Liferay 5.2 and Liferay 6.0 is liferay-portlet.xml and zk.xml zk.xml: use JQueryRenderCachedPatch org.zkoss.zk.portlet.PageRenderPatch.classorg.zkoss.zkplus.liferay.JQueryRenderCachedPatchorg.zkoss.zkplus.liferary.jQueryPatch1500 [since 5.0.11] use NonRootContextJQueryRenderPatch instead of JQueryRenderCachedPatch if the home page of Liferay is not under the root(/) path org.zkoss.zk.portlet.PageRenderPatch.classorg.zkoss.zkplus.liferay.NonRootContextJQueryRenderPatchorg.zkoss.zkplus.liferary.jQueryPatch1500 liferay-portlet.xml:

Liferay add this to the setting /zkau/web/js/zk.wpd

51

HelloZK2/zkau/web/js/zk.wpduserUserpower-userPower UseradministratorAdministrator liferay-display.xml

ategory.sample"> liferay-plugin-package.xml

rue">GPL 6.0.0+6.0.0+ portlet.xml HelloZK2HelloZK2HelloZK2org.zkoss.zk.ui.http.DHtmlLayoutPortlet0text/htmlviewenHelloZK2 PortletHelloZK2zk2zk_page/hello.zulpower-useruser

Liferay administrator Please download the following war file to view this example in detail Download DEPLOY_TO__HelloZK2.war [4]

53

See alsohttp://devenphillips.blogspot.com/2009/04/developing-liferay-portlets-with-zk.html ZK 5 / Liferay Integration - jquery conflict [5]

Version HistoryVersion Date Content

References[1] http:/ / www. liferay. com [2] https:/ / sourceforge. net/ projects/ zkforge/ files/ Small%20Talks/ How%20to%20Install%20ZK%20on%20Liferay/ DEPLOY_TO__HelloZK. war/ download [3] http:/ / www. liferay. com/ [4] https:/ / sourceforge. net/ projects/ zkforge/ files/ Small%20Talks/ How%20to%20Install%20ZK%20on%20Liferay/ DEPLOY_TO__HelloZK2. war/ download [5] http:/ / www. zkoss. org/ forum/ listComment/ 11051

Pluto

54

PlutoDeploy a ZK Porletweb.xmlDefine the definition of porlet in web.xml ZK PortletsZK loader for ZUML pageszkLoaderorg.zkoss.zk.ui.http.DHtmlLayoutServletupdate-uri/zkau1zkLoader*.zulzkLoader/zk/*The asynchronous update engine for ZKauEngineorg.zkoss.zk.au.http.DHtmlUpdateServletauEngine/zkau/*zkportletorg.apache.pluto.core.PortletServletportlet-namezkportlet

Pluto 1zkportlet/PlutoInvoker/zkportlet120index.zulindex.zhtmlindex.htmlindex.htmtomcat

55

portlet.xmlDefine a ZK portlet in portlet.xml. ZKloader for ZUML pageszkportletZK Portlet Loaderorg.zkoss.zk.ui.http.DHtmlLayoutPortletzk_page/index.zul0

Pluto

56

text/htmlVIEWenZKZKZK,ZUMLplutoTestRoletomcat

How to resolve Session TimeoutThe cause of this problem is that ZK cannot find the desktop from its session. Why? ZK desktop was stored in the session of pluto instead of ZK webapp because pluto pass its session to ZK webapp while doing cross-context in Tomcat. This breaks the spec of servlet. So far, there is no good solution. But here is a workaround that ZK stores desktop in application scope instead of session scope to avoid the problem. Please add the following lines in your zk.xml

org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider

Version HistoryVersion Date Content

Jetty

57

Jetty1. 2. 3. 4. Download Jetty from http://www.mortbay.org/jetty/index.html and install it, if you haven't installed it yet. Stop Jetty. Unzip zk-demo-x.x.x.zip or zk-demo.x.x.tar.gz Copy dist/lib/*.jar to $JETTY_HOME/lib

($JETTY_HOME is where you installed Jetty) 5. Copy dist/lib/ext/*.jar to $JETTY_HOME/lib 6. [Optional] Copy dist/lib/zkforge/*.jar to $JETTY_HOME/lib (It depends whether you need component from ZK Forge) 7. Deploy demo/bin/zkdemo.war to Jetty by copying it to $JETTY_HOME/webapps directly. 8. Start Jetty. 9. Browse to http://localhost/zkdemo/userguide or http://localhost:8080/zkdemo/userguide, depending on your configuration.

Version HistoryVersion Date Content

Resin1. 2. 3. 4. 5. 6. Download Resin from http://caucho.com/download/index.xtp and install it, if you haven't installed it yet. Stop Resin Unzip zk-1.0.0.zip or zk-1.0.0.tar.gz Copy dist/lib/*.jar to $RESIN_HOME/lib ($RESIN_HOME is where you installed Resin.) Copy dist/lib/ext/*.jar to $RESIN_HOME/lib [Optional] Copy dist/lib/zkforge/*.jar to $RESIN_HOME/lib (It depends whether you need component from ZK Forge) 7. Deploy demo/bin/zkdemo.war to Resin by copying it to $RESIN_HOME/webapps directly. 8. Start Resin. 9. Browse to http://localhost/zkdemo/userguide or http://localhost:8080/zkdemo/userguide, depending on your configuration. by Peter Manchev

Version HistoryVersion Date Content

Setting up OS

58

Setting up OSHere is the information related to the OS environment that some ZK components might depend on.

LinuxHere is the notes to set up the environment of Linux that some ZK components depends on.

Chart and CaptchaChart and Captcha depends on Java Swing. To make Swing works correctly under Linux, you have to install openjdk-6-jre[1] sudo apt-get install openjdk-6-jre sudo /etc/init.d/tomcat6 restart

[1] The default installation includes only openjdk-6-jre-headless and openjdk-6-jre-lib.

JaspserreportJasperreprot is based on the JasperReports project (http:/ / jasperforge. org/ projects/ jasperreports). To make it run correctly under Linux, you have to make sure all fonts that you use are installed. sudo aptitude install msttcorefonts sudo /etc/init.d/tomcat6 restart

The procedure to install fonts might depend on the version you use. Please refer to this discussion (http:/ / stackoverflow.com/questions/3218732/jasper-reports-pdf-generation-issue) for more information.

Version HistoryVersion Date Content

IOS

59

IOSHere is the notes to set up the environment of iOS.

Columns MenuSeveral components, such as Columns Menu, will adjust the position of popup to make sure it is on the left side of the right edge (so that it is totally visible). On the other hand, iOS Safari assumes the width to be 980px by default. Thus, if your web page is designed to have a different width, the calculation might be wrong. To solve this issue, you could specify the width in a meta tag called viewport as follows: For more information, please refer to Safari Developer Library [1].

onClick EventIn IOS device (ipad/iphone) you have to specify the following CSS (cursor:pointer) to make it work with onClick event.

Version HistoryVersion Date Content

IOS

60

References[1] http:/ / developer. apple. com/ library/ safari/ #documentation/ AppleApplications/ Reference/ SafariWebContent/ UsingtheViewport/ UsingtheViewport. html#/ / apple_ref/ doc/ uid/ TP40006509-SW24

Setting up IDE Eclipse with ZK StudioInstall Eclipse1. Visit Eclipse download page [2] and download Eclipse IDE for Java EE Developers [3] 2. Uncompress it to a proper directory 3. Then, eclipse is ready to start. For example, you could double-click eclipse.exe to start Eclipse under Windows.

Install ZK StudioFollow ZK Studio Installation Guide to install ZK Studio.

Defining a Server RuntimeBefore deploying and testing your application, you have to install a Web server (such as Tomcat) and specify the server in eclipse. For information of installing a server, please refer to ZK Installation Guide/Setting up Servers/Tomcat. To specify the server in eclipse, please do as follows. 1. 2. 3. 4. From menu goto Windows > Preferences... Select Server > Runtime Environments, then click Add Select Apache > Apache Tomcat v6.0 and click Next Browse to and select the root directory of the Web server installed in your computer

For example, the root directory of Apache Tomcat might be C:\Program Files\Apache Software Foundation\Tomcat 6.0 For how to install Tomcat, please refer to this section 5. Click Finish

Eclipse with ZK Studio

61

Create and Run Your First ZK ApplicationAfter installing Eclipse and ZK Studio, please take a look at Create and Run Your First ZK Application with Eclipse and ZK Studio.

Version HistoryVersion Date Content

Eclipse without ZK StudioPrepare EclipseInstall Eclipse1. Visit Eclipse download page [2] and download Eclipse IDE for Java EE Developers [3] 2. Uncompress it to a proper directory 3. Then, eclipse is ready to start. For example, you could double-click eclipse.exe to start Eclipse under Windows.

Setting up Eclipse without ZK StudioHere is the description of using ZK with Eclipse without ZK Studio. However, it is recommended to use ZK Studio for Eclipse [1], which is much more powerful and easier to use.

How to setup the zul.xsd schema into Eclipse1. 2. 3. 4. You should have setup Eclipse to work with ZK. The details is in the above smalltalk. Execute the Eclipse SDK. Select Window/Preferences... from the menu and the Preferences dialog popup. Select Web and XML/XML Catalog from the left sidebar tree menu and the right side is the XML Catalog panel. 5. Select User Specified Entries in the XML Catalog Entries field and press the Add... button. 6. The Add XML Catalog Entry dialog now popup: In URI field, type in http://www.zkoss.org/2005/zul/zul.xsd'''.Or, type in ZK_HOME/dist/WEB-INF/xsd/zul/zul.xsd (ZK_HOME is the directory where ZK's zip file was unziped). In Key Type field, select Schema Location. In Key field, type in http://www.zkoss.org/2005/zul/zul.xsd'''. Press OK button. 7. Now you should see a new entry http://www.zkoss.org/2005/zul/zul.xsd''' under the User Specified Entires. 8. Done.

Eclipse without ZK Studio

62

How to generate ZUL files from the ZUL schema using Eclipse1. 2. 3. 4. 5. You should have setup the zul.xsd schema into Eclipse. Select File/New/Other... from the Eclipse SDK menu and the New dialog popup. In Select a wizard page, select XML/XML from the tree menu and press Next > button. In Create XML File page, select Create XML file from an XML schema file and then press Next > button. In XML File Name page, type or select a proper parent folder for your project. It is generally under the WebContext folder of your project. Then type in the ZUL file name you want to create(e.g. helloworld.zul) and press Next > button. 6. In Select XML Schema File page, select Select XML catalog entry option. You should see the http://www. zkoss.org/2005/zul/zul.xsd''' in the XML Catalog list. Now select the entry and press Next > button. 7. In Select Root Element page: In Root Element field, pick a proper root element. In most ZK applications, it is generally a window or an zk element. In Content options field, you can leave as it is. In Namespace Information field, you can select the entry and press edit... button to take out the prefix or change the prefix. Press Finish button. 8. The ZUL file is created and opened on an XML editor window. 9. Now you can start editing your ZUL file. Press Alt-/ to open the Content Assist popup window to help you fill up proper ZUL elements and attributes. 10. Done.

Add Schema to ZUL ManuallyInstead of using Eclipse's XML wizard, you could specify the schema directly in your ZUL document, such that the validation and Content Assist will be enabled automatically. Here is an example. ... Notice that you have to specify the schema location in the root element, and the root element could be any valid ZUL component, such as window.

How to setup Eclipse to work with zhtml1. Select Window/Preferences... from the Eclipse SDK menu and the Preferences dialog will popup. 2. Select General and Content Types Catalog from the left sidebar tree menu and the right side is the Content Types panel. 3. Select Text and XML in the Content types and press the Add... button . 4. Add *.zhtml or such as *.zul, *.jsp, *.html etc. 5. Finally, you can press the RightClick on your file and choose the XML editor in the Open With menu. 6. Done.

Eclipse without ZK Studio

63

How to setup the Rational Application Developer RAD version of Eclipse to work with zhtml1. 2. 3. 4. Select Window/Preferences... from the SDK menu and the Preferences dialog will popup. Select Workbench/File Assocations then click on the top Add to add a file type *.zhtml Click on the lower Add and select HTML Source Page Editor and set it to be default Done

See Also Develop ZK Applications with Eclipse [2]

Version HistoryVersion Date Content

References[1] http:/ / www. zkoss. org/ product/ zkstudio. dsp [2] http:/ / www. zkoss. org/ smalltalks/ eclipse/ ek. html

MavenIf you don't know what Maven is, please take a look at the following URL(s): Maven Apache http://maven.apache.org/ Maven in 5 Minutes http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Setting up Maven on IDE

64

Setting up Maven on IDESetting up on EclipseHere describes how to set up Maven [1] on Eclipse

Prerequirement JAVA SDK : Java 5 or above is required to run Eclipse and Embedded Maven (you can still use any Java version as default in Eclipse and run external Maven using Java versions required by Maven) Make sure Eclipse is running on JDK and not on JRE

Eclipse Related Eclipse : 3.6 or later Go to Eclipse Downloads [2] Choose Eclipse IDE for Java EE Developers (It included WTP [3]) Eclipse Plugin, which can be installed by using the Eclipse Update Manager. The Eclipse Update Manager can be found by selecting Install New Software... from the Help menu. Then, click Add... to add the URL as a new update site. 1. M2eclipse[4] : Update Site : Eclipse 3.6.* and 3.7.*: http://download.eclipse.org/technology/m2e/releases [5] Eclipse 3.5.* and 3.6.*: http:/ / m2eclipse. sonatype. org/ sites/ m2e [6] (Please note: This version includes a Maven Archetype Bug. Therefore it is suggested to download and install a "newer" version of M2eclipse plugin to avoid this unresolved error.) Install Maven Integration for Eclipse (core feature)

2. (Optional but recommend) Run-Jetty-Run Update Site : http://run-jetty-run.googlecode.com/svn/trunk/updatesite/ [7] An amazing plug-in which enables you to run web applications in Eclipse using its embedded Jetty distribution. You will enjoy the awesome redeploy speed. Installation and usage documentation Run-Jetty-Run - Getting Started [8] 3. (Optional) M2eclipse Extra[9] Update Site : http://m2eclipse.sonatype.org/sites/m2e-extras [10] Install Maven Integration for WTP

Setting up Maven on IDE

65

4. (Optional) Eclipse IAM, formerly Q for Eclipse: Eclipse Integration for Apache Maven Q4e on Google Code [11] 5. (Optional) Subeclipse Get the latest subclipse plug-in as per plug-in instructions here update_1.6.x)[12]

(use this http:/ / subclipse. tigris. org/

Note: For 64-bit Windows & 64-bit Eclipse installation you will need to install Silksvn client download [13] to avoid JavaHL binding error.[1] [2] [3] [4] http:/ / maven. apache. org/ http:/ / www. eclipse. org/ downloads http:/ / www. eclipse. org/ webtools/ Official installation step

Eclipse 3.6.* and 3.7.*: (http:/ / eclipse. org/ m2e/ download/ ) Eclipse 3.5.* and 3.6.*: (http:/ / m2eclipse. sonatype. org/ installing-m2eclipse. html) [5] http:/ / download. eclipse. org/ technology/ m2e/ releases [6] http:/ / m2eclipse. sonatype. org/ sites/ m2e [7] http:/ / run-jetty-run. googlecode. com/ svn/ trunk/ updatesite/ [8] http:/ / code. google. com/ p/ run-jetty-run/ wiki/ GettingStarted [9] This plugin should be installed when you use WTP as your development server. [10] http:/ / m2eclipse. sonatype. org/ sites/ m2e-extras [11] http:/ / code. google. com/ p/ q4e/ [12] http:/ / subclipse. tigris. org/ install. html [13] http:/ / www. sliksvn. com/ en/ download

Version HistoryVersion Date Content

Use ZK Maven Archetype

66

Use ZK Maven ArchetypeAdd ZK Maven Archetype [Window] -> [Preferences] -> [Maven] --> [Archetypes]

Click Add Remote Catalog and type in the catalog file as illustrated:

Use ZK Maven Archetype

67

http:/ / mavensync. zkoss. org/ maven2/ Click Verify and then OK to add the catalog. If the Remote catalog is empty.[1][1] If an error message appears stating that the Remote catalog is empty, this is most likely due to a bug in the m2eclipse plugin in v0.12.x, MNGECLIPSE-2757 (https:/ / issues. sonatype. org/ browse/ MNGECLIPSE-2757). Until m2eclipse 0.13.x or newer versions are released and available, there are two possible workarounds: 1. Install the "older version" 0.10.x from the Installing m2eclipse (http:/ / m2eclipse. sonatype. org/ installing-m2eclipse. html) website. Users will first need to uninstall m2eclipse 0.12.x, restart, and then install 0.10.x available from the following site:

http://m2eclipse.sonatype.org/sites/m2e/0.10.2.20100623-1649/2. Install the newer version from the following site: http:/ / download. eclipse. org/ technology/ m2e/ releases You first will need to uninstall m2eclipse 0.12.x, restart Eclipse before you can install the newer version from the website above. (Please note: the newer version of M2eclipse plugin is not compatible with the old Maven Project. Therefore you must enable your maven project with the latest M2eclipse plugin from the Installing m2eclipse website.) 3. Create the plugin from the archetype using the Maven command line tool mvn, then use import existing maven project to add the generated project to Eclipse. For more details, please refer to Use the command line version of Maven to create a project.

Create and Run ZK Application with Maven Archetype

68

Create and Run ZK Application with Maven ArchetypeHow to create a ZK Maven web projectCreate a Maven Project [File] -> [New] -> [Other] --> [Maven Project]

Make sure Create a simple project is unticked in the first screen of the New Maven Project wizard and click Next >.

Create and Run ZK Application with Maven Archetype

69

From the Select an Archetype screen, select zk[1] from the catalog dropdown list.

Select zk-archetype-webapp from the list. (At the time of writing this is at version 0.8.0). Next, fill in details for group id, artifact id, version number and package name.

Create and Run ZK Application with Maven Archetype

70

If the property zk-version-since is missing.[2] Click Finish and the Eclipse status bar should say ' Creating zk-archetype-webapp ' and ' Updating Maven Dependencies '. If this is the user's first time dealing with ZK libraries, Maven will download the necessary dependencies to compile and run this example, and would be stored in .m2/repository in the user's home directory.

Create and Run ZK Application with Maven Archetype

71

[1] To add a ZK archetype catalog, click Configure then refer to Use ZK Maven Archetype for the complete instruction. [2] Users who are running this wizard for the first time, zk archetype would not have been downloaded into m2eclipse yet, and as a result may not populate the zk-version-since property correctly, leading to an error message like the following:

Unable to create project from archetype [org.zkoss:zk-archetype-webapp:0.8.0 -> http://mavensync.zkoss.org/maven2/], Archetype org.zkoss:zk-archetype-webapp:0.8.0 is not configured property ''zk-version-since'' is missing. The simple workaround for this problem is to just try again after clicking Finish to end the ZK Maven web project wizard. When re-running the wizard, the zk-version-since property should appear in the list this time.

How to run Maven project on Run-Jetty-Run (Optional)Notice that Run-Jetty-Run (http:/ / code. google. com/ p/ run-jetty-run/ ) is optional. The speed of deployment is much faster, but the server is Jetty (http:/ / jetty. codehaus. org/ jetty/ ) embedded in Run-Jetty-Run. If you prefer to use your own server, you could skip this step. 1. Go to Run Configurations

2. Double click on Jetty Webapp It will automatically fill-out Project / Ports / Context / WebApp Dir

Create and Run ZK Application with Maven Archetype

72

3. Click Run and start browsing local ZK application at http://127.0.0.1:8080/myapp/

Packing your project1. Go to Run As > Maven install

2. The project will then be packed into a war file and a zip file with source code.

Create and Run ZK Application with Maven Archetype

73

Use the command line version of Maven to create a project For instructions on how to set up maven, please refer to Maven (http://maven.apache.org/guides/ getting-started/maven-in-five-minutes.html). Go to the folder in Eclipse workspace, then run the following command: Calling archetype:generate -DarchetypeCatalog=http://mavensync.zkoss.org/maven2/'' - the plugin will first ask to choose the archetype from the zk catalog, please just enter the number of the archetype. It will then ask users to enter the values for groupId, the artifactId and the version of the project to create and the base package for the sources. It will then ask for confirmation of the configuration and perform the creation of the project. In the following example, webapp archetype (number 2) is selected and groupId is set to org.test, artifactId to myapp, version to 1.0-SNAPSHOT and package to org.test.myapp.$ mvn archetype:generate -DarchetypeCatalog=http://mavensync.zkoss.org/maven2/ [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] -----------------------------------------------------------------------[INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style)

[INFO] -----------------------------------------------------------------------[INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] [archetype:generate {execution: default-cli}] [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: http://mavensync.zkoss.org/maven2/ -> zk-archetype-component (zk-archetype-component) 2: http://mavensync.zkoss.org/maven2/ -> zk-archetype-webapp (zk-archetype-webapp) Choose a number: : 2 Downloading: http://mavensync.zkoss.org/maven2//org/zkoss/zk-archetype-webapp/0.8.0/zk-archetype-webapp-0.8.0.jar 11K downloaded (zk-archetype-webapp-0.8.0.jar)

Downloading: http://mavensync.zkoss.org/maven2//org/zkoss/zk-archetype-webapp/0.8.0/zk-archetype-webapp-0.8.0.pom

Create and Run ZK Application with Maven Archetype1K downloaded (zk-archetype-webapp-0.8.0.pom)

74

Define value for property 'groupId': : org.test Define value for property 'artifactId': : myapp Define value for property 'version': 1.0-SNAPSHOT: Define value for property 'package': org.test: org.test.myapp [INFO] Using property: zk-version-since = 5.0.6 Confirm properties configuration: groupId: org.test artifactId: myapp version: 1.0-SNAPSHOT package: org.test.myapp zk-version-since: 5.0.6 Y: [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 22 seconds [INFO] Finished at: Thu Jul 28 12:07:19 CST 2011 [INFO] Final Memory: 12M/150M [INFO] ------------------------------------------------------------------------

Import a Maven project into Eclipse [File] -> [Import] -> [Maven] --> [Existing Maven Projects]

After this, the user should now get a new project in the Package explorer.

Create and Run ZK Application with Maven Archetype

75

Create and Run ZK Application with MavenIf you are first to Maven, please refer to Create and Run ZK Application with Maven Archetype because it is easy to follow. This article is more helpful for users who already have a Maven project and/or want to handle some of the configuration files manually.

How to create ZK Maven web projectCreate Project of Maven [File] -> [New] -> [Other] --> [Maven Project]

ZK Maven Project Hierarchy

Create and Run ZK Application with Maven

76

Check Create a simple Project

Fill the first 4 field (you can change them later) --> Click [Finish] Group Id is usually the package name but it could be anything you prefer. Here we use org.zkoss, but it is better to use your own.

Create and Run ZK Application with Maven Arifact Id is your project's ID. Version is your project's version.

77

Create and Run ZK Application with Maven

78

Add WTP Support (Project Facet)1. Create new folder under /src/main/ named webapp 2. Right Click on your Maven Project -> Choose Properties -> Choose Project Facets -> Check Dynamic Web Module Note: if it showing Covert facet from..., simply click it to enable facet.

3. Click Further configuration available' --> input the Context Root and Content Directory --> Check Generate web.xml deployment descriptor

Create and Run ZK Application with Maven

79

Enable Dependency and Web Project configurationweb.xml Overwrite the content of /src/main/webapp/WEB-INF/web.xml with Sample of web.xml.

pom.xml Overwrite the content of pom.xml with Sample of pom.xml

How to run Maven project on Run-Jetty-Run (Optional)Notice that Run-Jetty-Run [1] is optional. The speed of deployment is much faster, but the server is Jetty embedded in Run-Jetty-Run. If you prefer to use your own server, you could skip this step. 1. Create new zul file index.zul [3] under /src/main/webapp 2. Goto Run Configurations[2]

3. Double click on Jetty Webapp It will auto fill Project / Port / Context / WebApp Dir

Create and Run ZK Application with Maven

80

4. Click Run and browse http://127.0.0.1:8080/TestMavenWebProject/[1] http:/ / code. google. com/ p/ run-jetty-run/ [2] http:/ / jetty. codehaus. org/ jetty/ [3] ZK Installation Guide/Quick Start/Create and Run Your First ZK Application with Eclipse and ZK Studio#Create_a_new_ZUL_file

Use ZK Maven Repository without IDE

81

Use ZK Maven Repository without IDEHow to Use ZK Maven RepositoryThis chapter describes how to use the Maven repository hosted by ZK. Here introduces you a simple example for using ZK maven repository in your maven build environment.

Setup a simple Maven Web application projectA simple Web application project will be created using Maven archetype plugin and archetype:generate goal. Please refer to the Maven reference for more information on archetype [1] mvn archetype:generate -DgroupId=com.mycompany -DartifactId=mywebapp -DpackageName=com.mycompany -Dversion=1.0-SNAPSHOT -DarchetypeArtifactId=maven-archetype-webapp

Here DgroupId, DartifactId, DpackageName and Dversion are user application specific whereas you can choose one of the Maven provided archetypes [1] for DarchetypeArtifactId parameter. Execute the above command on your command line and it will generate a simple web application project with default maven defined structure for you. Upon the creation of this project to navigate to project directory and you can see a default pom.xml file already generated by Maven. It will look something like this

4.0.0com.mycompanymywebappwar1.0-SNAPSHOTmywebapp Maven Webapphttp://maven.apache.orgjunitjunit3.8.1testmywebapp

Use ZK Maven Repository without IDE

82

Add ZK Maven repository to your pom.xml fileBy default while resolving project dependencies Maven will only look into Maven central repository [2]. In order to use ZK Maven repository add following element into pom.xml under the root element. zk repositoryhttp://mavensync.zkoss.org/maven2 Note that ZK Maven repository URL is http://mavensync.zkoss.org/maven2 [3].

Adding ZK library dependenciesDepending upon your project requirements your project might depend on various ZK libraries. You can declare these dependencies in pom.xml file and Maven can resolve them by automatically connecting to ZK Maven repository [3] Here is how you can declare a dependency for main ZK library and zul library for your project. org.zkoss.zkzk5.0.4org.zkoss.zkzul5.0.4 In order for Maven to successfully resolve these dependencies groupid and artifactid must match with those published on ZK Maven repository as they constitute what is known as Maven repository coordinates. For a complete list of all ZK library groupid and artifactid combinations please take a look at a sample pom.xml file that lists dependencies for all publically available ZK libraries on ZK Maven repository.

Sample of pom.xmlHere is sample pom.xml for a simple Java project that uses the ZK maven repository.

4.0.0zk.appMyZKMavenApp0.0.1-SNAPSHOTZK_CE

Use ZK Maven Repository without IDE ZK CE Repositoryhttp://mavensync.zkoss.org/maven2ZK_PEZK PE Evaluation Repositoryhttp://mavensync.zkoss.org/zk/pe-evalZK_EEZK EE Evaluation Repositoryhttp://mavensync.zkoss.org/zk/ee-eval ....

83

Sample of DependenciesZK CEorg.zkoss.zkzkplus5.0.9org.zkoss.zkzhtml5.0.9org.zkoss.zkzul5.0.9commons-loggingcommons-logging1.1.1commons-iocommons-io1.3.1

Use ZK Maven Repository without IDE commons-langcommons-lang2.4

84

ZK PEorg.zkoss.zkzkplus5.0.9org.zkoss.zkzhtml5.0.9org.zkoss.zkzkex5.0.9commons-loggingcommons-logging1.1.1commons-iocommons-io1.3.1commons-langcommons-lang2.4

Use ZK Maven Repository without IDE

85

ZK EEorg.zkoss.zkzkplus5.0.9org.zkoss.zkzhtml5.0.9org.zkoss.zkzkmax5.0.9commons-loggingcommons-logging1.1.1commons-iocommons-io1.3.1commons-langcommons-lang2.4

Use ZK Maven Repository without IDE

86

Download / Customize pom.xmlDownload directlyDownload Latest CE pom.xml [4] Download Latest PE pom.xml [5] (Evaluation Only) Download Latest EE pom.xml [6] (Evaluation Only)

Customize your own pom.xmlZK POM Customizer [7]

How to Choose the Right ZK Maven Repository for a ZK PackageZK has three editions: : CE, PE and EE. They are hosted in different Maven repository. I will guide you through how to choose the right edition, and set up the right ZK Maven repository.

Steps for choosing the right editionHere are the steps for choosing the right edition of ZK: Decide which edition to use: There are three editions of ZK: CE, PE and EE For more information, please refer to description about ZK Editions [8].

Use ZK Maven Repository without IDE

87

Add to your Maven projectsChoose the edition you want and add to you Super POM [9] 1. CE (Freely avaialable under LGPL) http://mavensync.zkoss.org/maven2 Sample Config ZK CEhttp://mavensync.zkoss.org/maven2 2. PE-eval / EE- eval (60-days free evaluation) PE-eval http://mavensync.zkoss.org/zk/pe-eval Sample Config ZK PE Evaluationhttp://mavensync.zkoss.org/zk/pe-eval EE-eval http://mavensync.zkoss.org/zk/ee-eval Sample Config ZK EE Evaluationhttp://mavensync.zkoss.org/zk/ee-eval 3. PE / EE (premium users only) Notice : Need Login authentication PE https://maven.zkoss.org/repo/zk/pe Sample Config ZK PEhttps://maven.zkoss.org/repo/zk/pe

Use ZK Maven Repository without IDE EE https://maven.zkoss.org/repo/zk/ee Sample Config ZK EEhttps://maven.zkoss.org/repo/zk/ee Login authentication According to the official doc [10] of Apache Maven, users can create global settings for maven. Location (if not existed, you can create it manually) The Maven install: $M2_HOME/conf/settings.xml A user's install: ${user.home}/.m2/settings.xml Servers Element If you add ZK PE or ZK EE as your repository, you need to add login authentication like following example ZK EEryanwu2k055ecret

88

Summary of JAR filesThere're something you need to know about ZK's edition and package(s).

Use ZK Maven Repository without IDE

89

CE zk.jar zul.jar zhtml.jar zcommon.jar zcommons-el.jar zweb.jar zkplus.jar zkex.jar zkmax.jar zml.jar V (only ZK 3) V V V V V V V

PE EE V V V V V V V V V V V V V V V V V V V

Description ZK core functions, such as ZK Loader and Update Engine. ZK XUL components (http://www.zkoss.org/2005/zul) ZK XHTML components (http://www.w3c.org/1999/xhtml) The common library that ZK depends on ZK EL expressions The Web library that ZK depends on ZK extra utilities integrated easily with other frameworks. ZK additional components and features for PE ZK additional components and features for EE ZK XML components for generating XML output

This will be helpful when you modify your dependencies of projects. 'Italic text'

Version HistoryVersion Date Content

References[1] http:/ / maven. apache. org/ guides/ introduction/ introduction-to-archetypes. html [2] http:/ / repo1. maven. org/ maven2 [3] http:/ / mavensync. zkoss. org/ maven2 [4] http:/ / www. zkoss. org/ services/ maven/ zk/ ?d=true& l=0& v=latest [5] http:/ / www. zkoss. org/ services/ maven/ zk/ ?d=true& l=1& v=latest [6] http:/ / www. zkoss. org/ services/ maven/ zk/ ?d=true& l=2& v=latest [7] http:/ / www. zkoss. org/ services/ maven/ zk/ [8] http:/ / www. zkoss. org/ product/ edition. dsp [9] http:/ / www. sonatype. com/ books/ mvnref-book/ reference/ pom-relationships-sect-pom. html#pom-relationships-sect-super-pom [10] http:/ / maven. apache. org/ settings. html#Servers

XML Editor

90

XML EditorIf you are using a XML editor, you could specify the schema directly in your ZUL document, such that the validation and Content Assist will be enabled automatically. Here is an example. ... Notice that you have to specify the schema location in the root element, and the root element could be any valid ZUL component, such as window.

Version HistoryVersion Date Content

Article Sources and Contributors

91

Article Sources and ContributorsZK Installation Guide Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide Contributors: Flyworld, Tmillsclare, Tomyeh Before You Start Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Before_You_Start Contributors: Alicelin, Tomyeh New to Java Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Before_You_Start/New_to_Java Contributors: Alicelin, Char, Flyworld, Tomyeh New to Java Servlet Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Before_You_Start/New_to_Java_Servlet Contributors: Alicelin, Char, Tomyeh Quick Start Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Quick_Start Contributors: Alicelin, Tomyeh Create and Run Your First ZK Application with Eclipse and ZK Studio Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_with_Eclipse_and_ZK_Studio Contributors: Alicelin, Char, PJ li, Peterkuo, Tomyeh Create and Run Your First ZK Application with NetBeans and REM Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_with_NetBeans_and_REM Contributors: Sphota, Tomyeh Create and Run Your First ZK Application Manually Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_Manually Contributors: Alicelin, Char, Flyworld, Tomyeh ZK Background Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/ZK_Background Contributors: Tomyeh Sample of web.xml for Servlet 3.0 Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/ZK_Background/Sample_of_web.xml_for_Servlet_3.0 Contributors: Tomyeh Sample of web.xml for Servlet 2.4 Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/ZK_Background/Sample_of_web.xml_for_Servlet_2.4 Contributors: Alicelin, Char, Tomyeh Sample of web.xml for Servlet 2.3 Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/ZK_Background/Sample_of_web.xml_for_Servlet_2.3 Contributors: Alicelin, Char, Tomyeh The Content of ZK Binary Distribution Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/ZK_Background/The_Content_of_ZK_Binary_Distribution Contributors: Ashishd, Benbai, Char, Flyworld, Jeanherb, Jumperchen, SimonPai, Tomyeh Setting up Servers Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers Contributors: Tomyeh Tomcat Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Tomcat Contributors: Alicelin, Char, Flyworld, Tomyeh JBoss Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/JBoss Contributors: Char, Jimmyshiau, Tomyeh WebSphere Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebSphere Contributors: Alicelin, Samchuang, Tomyeh Oracle Server Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Oracle_Server Contributors: Tomyeh WebLogic Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebLogic Contributors: Jimmyshiau, Tomyeh WebLogic Portal Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebLogic_Portal Contributors: Jimmyshiau, Southerncrossie WebLogic Cluster Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebLogic_Cluster Contributors: Jimmyshiau, Jumperchen, Tomyeh Google App Engine Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Google_App_Engine Contributors: Alicelin, Benbai, Jimmyshiau, Peterkuo, Southerncrossie, Tomyeh Liferay Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Liferay Contributors: Alicelin, Jimmyshiau, Samchuang, Southerncrossie, Tomyeh, Vincent Pluto Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Pluto Contributors: Tomyeh Jetty Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Jetty Contributors: Tomyeh Resin Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Resin Contributors: Tomyeh Setting up OS Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_OS Contributors: Tomyeh Linux Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_OS/Linux Contributors: Asuka, Tomyeh IOS Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_OS/IOS Contributors: Alicelin, Jimmyshiau, Jumperchen, Tomyeh Setting up IDE Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE Contributors: Tomyeh Eclipse with ZK Studio Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Eclipse_with_ZK_Studio Contributors: Alicelin, Char, Tomyeh Eclipse without ZK Studio Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Eclipse_without_ZK_Studio Contributors: Alicelin, Tomyeh Maven Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven Contributors: Alicelin, Flyworld, Tomyeh Setting up Maven on IDE Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Setting_up_Maven_on_IDE Contributors: Alicelin, Flyworld, Jimmyshiau, Jumperchen, Tomyeh Use ZK Maven Archetype Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Use_ZK_Maven_Archetype Contributors: Alicelin, Jimmyshiau, Jumperchen, Southerncrossie, Tomyeh Create and Run ZK Application with Maven Archetype Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Create_and_Run_ZK_Application_with_Maven_Archetype Contributors: Alicelin, Jimmyshiau, Southerncrossie, Tomyeh Create and Run ZK Application with Maven Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Create_and_Run_ZK_Application_with_Maven Contributors: Flyworld, Tomyeh Use ZK Maven Repository without IDE Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Use_ZK_Maven_Repository_without_IDE Contributors: Alicelin, Ashishd, Char, Flyworld, Jumperchen, Tmillsclare, Tomyeh XML Editor Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/XML_Editor Contributors: Tomyeh

Image Sources, Licenses and Contributors

92

Image Sources, Licenses and ContributorsImage:NewZULFileRightClick.png Source: http://new.zkoss.org/index.php?title=File:NewZULFileRightClick.png License: unknown Contributors: Tomyeh Image:NewZULFileWizard1.png Source: http://new.zkoss.org/index.php?title=File:NewZULFileWizard1.png License: unknown Contributors: Peterkuo, Tomyeh Image:testZUL.png Source: http://new.zkoss.org/index.php?title=File:TestZUL.png License: unknown Contributors: Peterkuo Image:runonserver.png Source: http://new.zkoss.org/index.php?title=File:Runonserver.png License: unknown Contributors: Tomyeh Image:runOnTomcat.png Source: http://new.zkoss.org/index.php?title=File:RunOnTomcat.png License: unknown Contributors: Tomyeh Image:testZULinBrowser.png Source: http://new.zkoss.org/index.php?title=File:TestZULinBrowser.png License: unknown Contributors: Peterkuo Image:ZKInstallationGuide_NetBeans_AddPlugins.png Source: http://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_AddPlugins.png License: unknown Contributors: Sphota Image:ZKInstallationGuide_NetBeans_InstallPlugin.png Source: http://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_InstallPlugin.png License: unknown Contributors: Sphota Image:ZKInstallationGuide_NetBeans_SelectNewZKProject.png Source: http://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_SelectNewZKProject.png License: unknown Contributors: Sphota Image: ZKInstallationGuide_NetBeans_CreateNewZKProject.png Source: http://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_CreateNewZKProject.png License: unknown Contributors: Sphota Image:ZKInstallationGuide_NetBeans_RunZKProject.png Source: http://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_RunZKProject.png License: unknown Contributors: Sphota Image:ZKInstallationGuide_NetBeans_RunZKDemo.png Source: http