PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information.
PDF generated at: Thu, 13 Sep 2012 11:30:10 CST
ZK Installation Guide For ZK 6.5.0 Contents Articles ZK Installation Guide 1 Before You Start 1 New to Java 1 New to Java Servlet 2 Quick Start 3 Create and Run Your First ZK Application with Eclipse and ZK Studio 3 Create and Run Your First ZK Application with Eclipse and Maven 8 Create and Run Your First ZK Application with NetBeans and REM 17 Create and Run Your First ZK Application Manually 21 ZK Background 23 Sample of web.xml for Servlet 3.0 23 Sample of web.xml for Servlet 2.4 24 Sample of web.xml for Servlet 2.3 26 The Content of ZK Binary Distribution 27 Setting up Servers 29 Tomcat 30 JBoss 31 JBoss Cluster 32 WebSphere 33 WebSphere Portal 37 Oracle Server 40 WebLogic 41 WebLogic Portal 42 WebLogic Cluster 47 Google App Engine 48 Heroku 52 Red Hat OpenShift Express 57 Liferay 60 Pluto 84 Jetty 87 Resin 87 Setting up OSGi 88 EclipseRT Web Starter Kits 88 Setting up OS 93 Linux 93 IOS 94 Setting up IDE 95 Eclipse with ZK Studio 95 Eclipse without ZK Studio 96 Maven 98 Setting up Maven on Eclipse 99 Resolving ZK Framework Artifacts via Maven 101 XML Editor 108 References Article Sources and Contributors 109 Image Sources, Licenses and Contributors 111 ZK Installation Guide 1 ZK Installation Guide Documentation:Books/ZK_Installation_Guide <comment>http:/ / books. zkoss. org/ wiki/ ZK_Installation_Guide</comment> Before You Start Before 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 Java You 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 Tutorials Here are some good Java tutorials. Java URLs Language Basic [1] [1] Class and Object [2] [2] [3] [3] [4] [4] New to Java 2 Install Java SE Development Kit ZK supports JDK [5] 5, 6 and later [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] http:/ / java.sun.com/ docs/ books/ tutorial/ java/ nutsandbolts/ index. html [2] http:/ / java.sun.com/ docs/ books/ tutorial/ java/ concepts/ index. html [3] http:/ / java.sun.com/ docs/ books/ tutorial/ java/ javaOO/ index. html [4] http:/ / java.sun.com/ docs/ books/ tutorial/ java/ IandI/ index. html [5] Java SE Development Kit [6] For Java 1.4, please use ZK 5 instead. Version History Version Date Content New to Java Servlet You 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 Tuturials A 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 History Version Date Content References [1] http:/ / richjava.wordpress. com/ [2] http:/ / en. wikipedia. org/ wiki/ Web_container [3] http:/ / www. google. com. tw/ search?q=define:Java+ Servlet [4] http:/ / tomcat. apache. org/ Quick Start This chapter describes how to quickly start your first ZK application. Create and Run Your First ZK Application with Eclipse and ZK Studio ZK 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 Eclipse Install Eclipse 1. 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. Prerequisites You can follow ZK Studio Installation Guide [4] to install ZK Studio. There are prerequisites you have to set up 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] Create and Run Your First ZK Application with Eclipse and ZK Studio 4 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. Installing ZK Studio Please 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 Runtime Before 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. From menu goto Windows > Preferences... 2. Select Server > Runtime Environments, then click Add 3. Select Apache > Apache Tomcat v6.0 and then click Next 4. 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 5. Click Finish Create a "Hello World" application from scratch with ZK Sutdio Create 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: <gflash width="945" height="685">Zk_studio_094_new_zk_project.swf</gflash> For detailed steps, please refer to Create a New ZK Project Create a new ZUL file 1. 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 application 1. 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. Version History Version 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 Create and Run Your First ZK Application with Eclipse and ZK Studio 8 [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 Eclipse and Maven M2eclipse [1] is the first and most mature of the projects aimed at integrating Apache Maven [2] within the Eclipse IDE. Prepare Eclipse Install Eclipse Please follow the installation guide for your Eclipse: Install Eclipse Install M2eclipse Please follow the installation guide for your M2eclipse: Install M2eclipse Create and Run Your First ZK Application with Eclipse and Maven 9 Add ZK Maven Archetype [Window] -> [Preferences] -> [Maven] --> [Archetypes], click Add Remote Catalog and type in the catalog file as illustrated: http://mavensync.zkoss.org/maven2/ Click Verify and then OK to add the catalog. If the Remote catalog is empty. [3] [1] http:/ / www. eclipse.org/ m2e/ [2] http:/ / maven. apache. org/ [3] 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 Your First ZK Application with Eclipse and Maven 10 Create a "Hello World" application with ZK Maven Archetype Create 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 Your First ZK Application with Eclipse and Maven 11 From the Select an Archetype screen, select ZK Maven Archetype from the catalog dropdown list. Select zk-archetype-webapp from the list. (At the time of writing this is at version 6.0). Next, fill in details for group id, artifact id, version number and package name. Create and Run Your First ZK Application with Eclipse and Maven 12 If the property zk-version-since is missing. [1] 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 Your First ZK Application with Eclipse and Maven 13 [1] 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:6.0 -> http://mavensync.zkoss.org/maven2/], Archetype org.zkoss:zk-archetype-webapp:6.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. Run the application 1. Go to Run As > Maven build... 2. In the goals field, enter jetty:stop jetty:run and tick Skip Tests then click "Apply" then "Run". 3. View the result in your browser. http://localhost:8080/mywebapp/index.zul (http://localhost:8080/mywebapp/index.zul) Create and Run Your First ZK Application with Eclipse and Maven 14 Packaging your porject into a Web Application Archive (WAR) 1. Go to Run As > Maven install 2. The project will then be packed into a war file and a zip file with source code. Use the command line version of Maven to create a project Create a Maven 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. Create and Run Your First ZK Application with Eclipse and Maven 15 In the following example, webapp archetype (number 3) is selected and groupId is set to com.foo, artifactId to mywebapp, version to '0.8.0 and package to com.foo'. $ 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 (An archetype th at generates a starter ZK component project) 2: http://mavensync.zkoss.org/maven2/ -> zk-archetype-extension (An archetype th at generates a starter ZK extension project) 3: http://mavensync.zkoss.org/maven2/ -> zk-archetype-webapp (An archetype that generates a starter ZK CE webapp project) 4: http://mavensync.zkoss.org/maven2/ -> zk-ee-eval-archetype-webapp (An archety pe that generates a starter ZK EE-eval webapp project) Choose a number: : 3 Define value for property 'groupId': : com.foo Define value for property 'artifactId': : mywebapp Define value for property 'version': 1.0-SNAPSHOT: 0.8.0 Define value for property 'package': com.foo: [INFO] Using property: zk-version-since = 6.0.1 Confirm properties configuration: groupId: com.foo artifactId: mywebapp version: 0.8.0 package: com.foo zk-version-since: 6.0.1 Y: [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 29 seconds [INFO] Finished at: Fri Jun 22 16:55:27 CST 2012 [INFO] Final Memory: 13M/150M [INFO] ------------------------------------------------------------------------ Create and Run Your First ZK Application with Eclipse and Maven 16 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 Your First ZK Application with Eclipse and Maven 17 Version History Version Date Content Create and Run Your First ZK Application with NetBeans and REM REM [1] is a NetBeans module for ZK application development contributed by Mr. Sotohiro Terashima. Install NetBeans REM Install NetBeans 1. Download the latest NetBeans IDE from here [2] 2. Follow the installation wizard Install REM plugin 1. 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 18 6. Click "Install" and follow the NetBeans plugin manager prompts Create a New ZK Project 1. 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 19 3. Confirm and create a new ZK project. 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 20 Deploy the ZK Demo Project 1. 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 21 Version History Version 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 Manually Prepare the server Install Tomcat First, you have to prepare a Web server. You can use any Web servers that support Java Servlet (2.3 or later). Here we introduce the installation of Tomcat [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 Libraries ZK libraries can be downloaded from ZK Download [3] and then save it to a proper location. Create your first application Here shows you how to create a web application manually without IDE or other tools. Create Web application ZK Web Applications use a standard directory structure defined in the Servlet specification. When developing ZK web applications, you must follow this structure so that the application can be deployed in any J2EE compliant web servers. All you need to do is create a web application directory with related files. Now i create one for example named myZK Create and Run Your First ZK Application Manually 22 Install Library Distribution 1. Unzip zk-bin-x.x.x.zip (the x.x.x is the latest version) 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 file Here is a simple zul file named hello.zul. <window title="My First ZK Application" border="normal"> Hello World! </window> Pack your project 1. Compress the myZK directory(e.g. myZK.zip) 2. Rename myZK.zip to myZK.war 3. Done!! Confirm your ZK Web Archive (WAR) file myZK.war hello.zul
- WEB-INF web.xml
- lib *.jar Create and Run Your First ZK Application Manually 23 Version History Version 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 Background This 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.0 ZK 6 supports Servlet 3.0 Pluggability, so you don't have to configure WEB-INF/web.xml at all. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <description><![CDATA[My ZK Application]]></description> <display-name>MyApp</display-name> </web-app> 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 History Version Date Content 6.0.0 December 2011 The support of Servlet 3.0 Pluggability was introduced. Sample of web.xml for Servlet 2.4 24 Sample of web.xml for Servlet 2.4 After 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. <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <description><![CDATA[My ZK Application]]></description> <display-name>MyApp</display-name> <listener> <description>ZK listener for session cleanup</description> <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class> </listener> <servlet> <description>ZK loader for ZUML pages</description> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zhtml</url-pattern> </servlet-mapping> <!-- Optional. Uncomment it if you want to use richlets. <servlet-mapping> Sample of web.xml for Servlet 2.4 25 <servlet-name>zkLoader</servlet-name> <url-pattern>/zk/*</url-pattern> </servlet-mapping> --> <servlet> <description>The asynchronous update engine for ZK</description> <servlet-name>auEngine</servlet-name> <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> </web-app> Version History Version 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 26 Sample of web.xml for Servlet 2.3 Here is the sample web.xml for servers that support Servlet 2.3 only. 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. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <description><![CDATA[My ZK Application]]></description> <display-name>MyApp</display-name>
<servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zhtml</url-pattern> </servlet-mapping> <!-- Optional. Uncomment it if you want to use richlets. <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>/zk/*</url-pattern> Sample of web.xml for Servlet 2.3 27 </servlet-mapping> --> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> </web-app> Version History Version Date Content The Content of ZK Binary Distribution Directory Structure The content of the ZK binary distribution is as follows. /doc This directory holds the documents including release notes and license. /dist /dist/lib This directory holds the ZK libraries Filename Description License Shipped zcommon.jar ZK's common library that ZK depends on (org.zkoss.*) LGPL All zweb.jar ZK's Web library that ZK depends on (org.zkoss.web.* LGPL All zk.jar ZK core functions, such as ZK Loader and Update Engine. (org.zkoss.zk.*) LGPL All zul.jar ZUL components (org.zkoss.zul.*) LGPL All zhtml.jar ZK HTML (ZHTML) components (org.zkoss.zhtml.*) LGPL All zkbind.jar ZK Bind, including data binding and MVVM. LGPL All zkplus.jar ZK extra utilities integrated easily with other frameworks. (org.zkoss.zkplus.*) LGPL All zel.jar ZK's implementation of EL 2.2. It is based on Apache Tomcat 7's EL 2.2 implementation. Apache All zkex.jar ZK professional ZUL components and utilities (org.zkoss.zkex.*) Commercial ZK PE and EE only The Content of ZK Binary Distribution 28 zml.jar ZK XML components for generating XML output (org.zkoss.zml.*) Commercial ZK PE and EE only zkmax.jar ZK enterprise components and utilities (org.zkoss.*) 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 Description License Version Shipped sapphire.jar Required if you want to use the sapphire theme. LGPL 6.0.0 All silvertail.jar Required if you want to use the silvertail theme. LGPL 6.0.0 All ckez.jar Required if you want to use ZK CKeditor component. LGPL 3.6.0.1 All timelinez.jar Required if you want to use ZK Timeline component. GPL 2.3.1_50 ZK PE and EE only timeplotz.jar Required if you want to use ZK Timeplot component. GPL 1.1_50 ZK EE only gmapsz.jar Required if you want to use ZK Google Maps component. GPL 2.0.52 ZK EE only zuljsp.jar Required if you want to use ZK JSP Tags. GPL 2.0 ZK EE only /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. Filename Description License Version Shipped commons-fileupload.jar commons-io.jar Required if you want to upload files with them. Apache Commons Fileupload 1.2.2 Commons IO 2.1 All jcommon.jar jfreechar.jar Required if you want to use ZUL's chart component. LGPL JFreeChart 1.0.14 JCommon 1.0.17 ZK PE and EE only jasperreports.jar itext.jar jxl.jar poi.jar commons-collections.jar commons-logging.jar commons-digester.jar Required if you want to use the jasperreport component. LGPL (jasperreports) Jasper Reports 4.5.1 (itext: 2.1.7, commons-collections: 3.2.1, commons-logging: 1.1.1, commons-digester: 2.1, jxl: 2.6.12, poi: 3.7) 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). LGPL BeanShell 2.0b4 All Filters.jar Required if you want to use the captcha component. 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 The Content of ZK Binary Distribution 29 their websites, or from ZK's Git repository (https:/ / github. com/ zkoss/ zk/ tree/ master/ dist/ lib/ ext). /dist/src This 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/xsd This directory holds the XSD files that might be useful to develop ZK applications. /dist/WEB-INF This 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 History Version Date Content Setting up Servers If you are new to Web servers, you could start with ZK Installation Guide/Setting up Servers/Tomcat. Tomcat 30 Tomcat Install Tomcat 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 Any download/install problem, please refer to http:/ / tomcat. apache. org/ tomcat-6. 0-doc/ index. html Deploy Deploy 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. Download the lastest zkdemo at http:/ / sourceforge. net/ projects/ zk1/ files/ ZK/ (e.g. zk-sandbox-6.0.0.zip) 2. Unzip zk-sandbox-6.0.0.zip 3. Copy zkdemo.war under the zk-sandbox-6.0.0 directory to $TOMCAT_HOME/webapps. 4. Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.) 5. 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 Deploy your application with IDE When 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 History Version Date Content JBoss 31 JBoss JBoss 4.0 and above 1. Download Jboss from http:/ / www. jboss. com/ downloads/ index and install it,if you haven't installed it. 2. Test the Jboss using link http:/ / localhost:port, if it's OK stop the server. 3. Unzip zk-demo-XXX.zip or zk-demo-XXX.tar.gz 4. Copy dist/lib/*.jar and dist/lib/*/*.jar to the $JBOSS_HOME/server/default/lib 5. Copy zkdemo.war to $JBOSS_HOME/server/default/deploy 6. Start the server. 7. 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.1 1. 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) Version History Version Date Content JBoss Cluster 32 JBoss Cluster Before You Start You have to configure the following setting for Web and JBoss. web.xml According to JBoss' tutorial, it is required to add the following settings in WEB-INF/web.xml if you are doing clustering in JBoss. <?xml version="1.0"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<distributable/> </web-app> jboss-web.xml Create jboss-web.xml file under under XXX/WEB-INF folder(XXX is like ZKsandbox in the war file) if fileupload component is used in your app. For example, <jboss-web> <context-root>warFileName</context-root> <!-- context-root should be the same with war file name --> <replication-config> <cache-name>standard-session-cache</cache-name> <replication-trigger>SET_AND_GET</replication-trigger> <replication-granularity>SESSION</replication-granularity> <replication-field-batch-mode>true</replication-field-batch-mode> <use-jk>true</use-jk> <max-unreplicated-interval>30</max-unreplicated-interval> <snapshot-mode>INSTANT</snapshot-mode> <snapshot-interval>1000</snapshot-interval> </replication-config> <max-active-sessions>5</max-active-sessions> <passivation-config> <use-session-passivation>true</use-session-passivation> <passivation-min-idle-time>60</passivation-min-idle-time> <passivation-max-idle-time>600</passivation-max-idle-time> </passivation-config> </jboss-web> JBoss Cluster 33 Setting up JBoss 5.1.0 Clusters with Apache Load Balance After you have done the settings above, please follow JBoss' official document to set up a JBoss Clustered Server here [1] . References [1] http:/ / docs.jboss. org/ jbossclustering/ cluster_guide/ 5.1/ html-single/ index. html WebSphere IBM WebSphere 1. 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 7 Import war file 1. Applications -> Application Types -> WebSphere enterprise applications -> Click install button 2. Select war file to import WebSphere 34 3. Select Fast Path 4. Go through Steps, in Step 4, input Context Root 5. Save configuration 6. Start application Find web application port 1. Servers -> Server Types -> WebSphere application servers -> Click "server1" 2. Communcations -> Click on "Ports" WebSphere 35 3. Check WC_defaulthost WebSphere 36 View Web application Version History Version Date Content WebSphere Portal 37 WebSphere Portal Setting up Websphere Portal Download Websphere Portal from IBM [1] Follow the installation guide here [2] to install Browse http:/ / localhost:10039/ wps/ portal and set up admin account and password Create ZK portlet project since 6.0.1 Create a ZK project by ZK Studio Add the following portlet.xml file under /WEB-INF <?xml version="1.0" encoding="UTF-8"?> <portlet-app version="2.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <portlet-name>zk</portlet-name> <display-name>zk</display-name> <portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class> <init-param> <name>zk_page</name> <value>/index.zul</value> <!-- the main page of portlet --> </init-param> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> </supports> <portlet-info> <title>zk</title> <short-title>zk</short-title> <keywords>zk</keywords> </portlet-info> <security-role-ref> <role-name>administrator</role-name> </security-role-ref> <security-role-ref> <role-name>guest</role-name> </security-role-ref> WebSphere Portal 38 <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> </portlet> </portlet-app> Export the project as a war file Deploy ZK portlet in WebSphere Portal Browse http:/ / localhost:10039/ wps/ portal and login with admin account Click Administration tab at the top of the page Select Web Module then click the install button. Click Choose File button to select the war file then press the Next button. Check the war information and choose Start application, then click the Finish button. Go back to Home page Add a new tab page by clicking Action -> EditPage Click New Page then enter "Page name" and "Friendly URL Name" WebSphere Portal 39 Add the deployed portlet to the created new page by clicking Action -> EditPage. Click Customize -> All -> in the search box, enter the portlet name defined in portlet.xml Drag and drop the portlet into the created new page and click Save & Exit button. ZK project is now deployed in a Websphere Portal WebSphere Portal 40 Version History Version Date Content References [1] http:/ / www14.software.ibm. com/ webapp/ download/ byproduct. jsp?pgel=ibmhzn1& cm_re=masthead-_-supdl-_-dl-trials [2] http:/ / www-10.lotus. com/ ldd/ portalwiki. nsf/ dx/ Installing_wp7 Oracle Server Oracle OC4J and Oracle OPMN Release 3 OC4J 10.1.3 (release 3) is the first production version of Oracle Containers 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 <data id="oc4j-options" value="-userThreads" />) 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 earlier Prior 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 but the web.xml configuration file is a bit different. Also notice that ZK 6 and later no longer support Java 1.4. Version History Version Date Content WebLogic 41 WebLogic 1. 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 History Version Date Content References [1] http:/ / commerce. bea.com/ showproduct.jsp?family=WLS& major=9. 1& minor=0 WebLogic Portal 42 WebLogic Portal Introduction Weblogic 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 Portlet 1. Right click on portlet folder > [New] > [Portlet] 2. Give a file name then click Next. WebLogic Portal 43 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 44 Add Zul page to your webapp Create myZulPage.zul in the WebContent/portlet/myzulpage folder. WebLogic Portal 45 Add portlet to portal page 1. Drag myZulPage.portlet to "Page 1" in the index.portal. 2. Done. WebLogic Portal 46 Run the weblogic server Run the server and access your application in the following link, http:/ / localhost:7001/ myPortalWebProject/ index. portal [1] . Version History Version Date Content References [1] http:/ / localhost:7001/ myPortalWebProject/ index.portal WebLogic Cluster 47 WebLogic Cluster Before You Start You have to configure the following setting for ZK and Weblogic. zk.xml Turn on Serializable UI Factory for ZK, please refer to this documentation. <zk> <system-config> <ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class> </system-config> <!-- clustering environment, since ZK 5.0.8--> <listener> <listener-class>org.zkoss.zkplus.cluster.ClusterSessionPatch</listener-class> </listener> </zk> weblogic.xml Add a weblogic.xml under XXX/WEB-INF folder(XXX is like ZKsandbox in the war file) For example, <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"> <weblogic-web-app> <session-descriptor> <session-param> <param-name>PersistentStoreType</param-name> <param-value>replicated</param-value> </session-param> </session-descriptor> </weblogic-web-app> As mentioned in Weblogic's document [1] replicated Same as memory, but session data is replicated across the clustered servers. WebLogic Cluster 48 Setting up Weblogic Clusters After those things done above, please follow the official document to set up a Weblogic Cluster Server here [2] . Version History Version Date Content 5.0.8 June 2011 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 Engine Get Your App Engine Account Ready First, you have to sign up an App Engine [1] account and download the App Engine SDK. Refer to the official website [1] for details. To use Google App Engine for Java, you have to take one additional step: sign up here [2] . In addition, since GAE is a clustered platform, your application must be ready for clustering, such as implementing serializable. For more information, please refer to ZK Developer's Reference: Clustering/Programming Tips. Configure Your App Engine Project Here 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 File The 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. <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> <listener> <description>ZK listener for session cleanup</description> <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class> </listener> <servlet> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> Google App Engine 49 <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>auEngine</servlet-name> <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> The zk.xml File Google 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. <zk> <!-- clustering environment --> <system-config> <disable-event-thread/> <ui-factory-class>org.zkoss.zk.ui.http.SerializableUiFactory</ui-factory-class> </system-config> <!-- clustering environment (available since ZK 5.0.8)--> <listener> <listener-class>org.zkoss.zkplus.cluster.ClusterSessionPatch</listener-class> </listener> <!-- [Required if ZK 5] disable the use of LogManager (prohibited by GAE). --> <library-property> <name>org.zkoss.util.logging.hierarchy.disabled</name> <value>true</value> Google App Engine 50 </library-property> <!-- GAE doesn't allow user's thread --> <client-config> <resend-delay>-1</resend-delay> </client-config> </zk> 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 File App Engine requires one addition configuration file named appengine-web.xml. It resides in the WEB-INF directory. <sessions-enabled>true</sessions-enabled> <static-files> <exclude path="/**.zul"/> <exclude path="/**.zhtml"/> </static-files> <resource-files> <include path="/**.zul"/> <include path="/**.zhtml"/> </resource-files> More Information Due 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] http:/ / code. google. com/ appengine/ [2] http:/ / appengine. google. com/ promo/ java_runtime [3] http:/ / code. google. com/ appengine/ docs/ java/ gettingstarted/ [4] 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 Solutions GAE 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 51 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()); } } Sample Download (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 History Version Date Content 5.0.8 June 2011 Add ClusterSessionPatch listener to zk.xml for enforce GAE to write session. 5.0.9 September 2011 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. Heroku 52 Heroku Get Your Heroku Ready Refer to Getting Started with Heroku [1] for getting Heroku ready. You should have Ruby, Git, and Heroku Gem installed and have applied for a Heroku account. Deploy ZK Project to Heroku Heroku only allow Maven Projects. Follow this guide [2] to create a ZK-Maven Project. After you have created a ZK-Maven project, you can decide to run with either Jetty or Tomcat. ZK Maven Project With Jetty Server Embedded 1. Modify pom.xml to add embedded Jetty web container for running on Heroku. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.3</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-runner</artifactId> <version>7.5.4.v20111024</version> <destFileName>jetty-runner.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> 3. Create a file named Procfile in Project root to tell Heroku how to execute the application web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war Heroku 53 ZK Maven Project With Tomcat Server Embedded 1. Create Main.java in src/main/java with package launch to start embedded Tomcat server. package launch; import java.io.File; import org.apache.catalina.startup.Tomcat; public class Main { public static void main(String[] args) throws Exception { String webappDirLocation = "src/main/webapp/"; Tomcat tomcat = new Tomcat(); // The port that we should run on can be set into an environment variable // Look for that variable and default to 8080 if it isn't there. String webPort = System.getenv("PORT"); if (webPort == null || webPort.isEmpty()) { webPort = "8080"; } tomcat.setPort(Integer.valueOf(webPort).intValue()); tomcat.addWebapp("/", new File(webappDirLocation).getAbsolutePath()); System.out.println("configuring app with basedir: " + new File("./" + webappDirLocation).getAbsolutePath()); tomcat.start(); tomcat.getServer().await(); } } 3. Modify pom.xml. a) Remove <package>war</package> line to make Main.class work b) Add embedded Tomcat web container for running on Heroku. <!-- <packaging>war</packaging> --> ... <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>7.0.22</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> Heroku 54 <artifactId>tomcat-embed-logging-juli</artifactId> <version>7.0.22</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <version>7.0.22</version> </dependency> <!-- The following three dependencies are used for JSP. If you application doesn't contain JSP, simply remove them --> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper</artifactId> <version>7.0.22</version> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper-el</artifactId> <version>7.0.22</version> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jsp-api</artifactId> <version>7.0.22</version> </dependency> ... <!-- Add the plugin to start ''Main.class'' --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <assembleDirectory>target</assembleDirectory> <programs> <program> <mainClass>launch.Main</mainClass> <name>webapp</name> </program> </programs> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> </goals> </execution> </executions> Heroku 55 </plugin> ... 7. Create a file named Procfile in Project root to tell Heroku how to execute the application web: sh target/bin/webapp Deploy to Heroku Once the server is ready, we can deploy to Heroku. 1. Initialize git repository. cd projectName git init 3. Create a .gitignore file to ignore all the files under target folder as these files are unnecessary to be managed and included by git repository. target 5. Commit project source code to git repository. git add . git commit -m "CommitMessageNote" 7. Create Heroku app on Cedar stack and Heroku will create an app with a random AppName that can be changed later: heroku create --stack cedar 9. Deploy the code git push heroku master 11. Rename the AppName (Optional) heroku rename newname 13. Visit the application heroku open Heroku 56 Update Source Code changes to Heroku If you wish to make changes to the app deployed on Heroku, follow the steps below: 1. Commit project source code to git repository. git add . git commit -m "CommitMessageNote" 3. Deploy the code git push heroku master 5. Visit the changes heroku open Sample Download [3] the sample maven project named heroku_zksandbox.zip. Sandbox sample is deployed on Heroku at http:/ / zksandbox. herokuapp. com/ [4] . References [1] http:/ / devcenter. heroku. com/ articles/ quickstart [2] http:/ / books. zkoss. org/ wiki/ ZK_Installation_Guide/ Setting_up_IDE/ Maven/ Create_and_Run_ZK_Application_with_Maven_Archetype [3] http:/ / sourceforge. net/ projects/ zkforge/ files/ Small%20Talks/ ZK%20Sandbox%20for%20Heroku/ [4] http:/ / zksandbox. herokuapp. com/ Red Hat OpenShift Express 57 Red Hat OpenShift Express Get Your OpenShift Ready Apply a new OpenShift account if you don't have a Red Hat Network (RHN) account. If you prefer to use Eclipse, you can install Eclipse plugin to create OpenShift domain and application without following the prerequisites and steps listed below. Here is the video [1] that demonstrates how you can use Eclipse plugin to do so. If you are doing so, you do not need to follow the next a few steps. Refer to OpenShift User Guide [2] for required client tools. 1. Prerequisites for Red Hat Enterprise Linux or Fedora: RHEL 6 and up or Fedora 14 and up. Express repo file openshift.repo [3] View video walkthrough [4] 2. Prerequisites for Other Linuxes: Root access Ruby 1.8 or higher installed or available to be installed Install the required packages: git, ruby, rubygems, and the ruby 1.8 development package. 3. Prerequisites for Mac: git 4. Prerequisites for Windows: Cygwin [5] with the following optional components: openssh ruby make gcc git RubyGems [6] Create an OpenShift domain name Run rhc-create-domain command to create an unique domain name for your application. $ rhc-create-domain -n DomainName -l rhlogin -p password -n DomainName specifies the domain that you want to create. This must contain a maximum of 16 alphanumeric characters. -l rhlogin your OpenShift Express or RHN account. -p password your OpenShift Express or RHN password. Red Hat OpenShift Express 58 Create a Maven Application Run rhc-create-app command and OpenShift will create a maven project with default page automatically. $ rhc-create-app -a AppName -t Type -l rhlogin -p password -a AppName The name of the application to create (maximum of 32 alphanumeric characters). -t Type The framework type to create. OpenShift Express currently supports the following application types: php-5.3 for PHP applications wsgi-3.2 for Web Server Gateway Interface applications rack-1.1 for Ruby Webserver Interface applications perl-5.10 for Perl applications jbossas-7.0 for JBoss AS applications (used for ZK project) raw-0.1 a raw cartridge type used to create applications of no specific type -l rhlogin your OpenShift Express or RHN account. -p password your OpenShift Express or RHN password. Once it is done the application is on the cloud, you can visit http:/ / AppName-DomainName. rhcloud. com/ to see the default OpenShift page. Import into Eclipse IDE (Optional) If you wish to use Eclipse, Run the following command to support Eclipse. $ mvn eclipse:eclipse Refer to here to import into Eclipse. Deploy changes to OpenShift Once you have created an OpenShift application in your local machine following the steps above, the application is at the same time deployed to the cloud. To update and make changes to your application, you have to make changes in the git directory specified during the application creation process. There are two options to deploy the changes: Option 1: Upload contents in a Maven src structure This option is simple and recommended. Just push the source code with "git push" command. $ cd AppName $ git add . $ git commit -a -m "Commit Message" $ git push origin master Then OpenShift will build your project on cloud. Once it's done you can visit http:/ / AppName-DomainName. rhcloud. com/ to see your application. Red Hat OpenShift Express 59 Option 2: Upload prebuilt contents If you do not wish OpenShift to build your project automatically, you have to remove pom.xml file and all the source code. $ cd AppName $ git rm -r src/ pom.xml Then, copy the pre-built war file into deployments folder and rename it to ROOT.war [7] $ cp target/prebuilt.war deployments/ROOT.war $ git add . $ git commit -a -m "Commit Message" $ git push origin master Once it's done you can visit http:/ / appName-domainName. rhcloud. com/ to see the result [1] https:/ / www. redhat. com/ openshift/ community/ blogs/ deploying-java-apps-to-the-cloud-with-the-openshift-eclipse-plug-in [2] http:/ / docs.redhat.com/ docs/ en-US/ OpenShift_Express/ 1. 0/ html/ User_Guide/ index. html [3] https:/ / openshift. redhat. com/ app/ repo/ openshift.repo [4] http:/ / www. youtube.com/ watch?v=KLtbuvyJFFE [5] http:/ / www. cygwin.com/ [6] http:/ / rubyforge. org/ projects/ rubygems [7] By default the warName is ROOT within the pom.xml file. This will render the webapp contents at http:/ / app_name-namespace. rhcloud. com. If you change the warName in pom.xml to "app_name" or if the warName in deployments folder is "app_name.war", then your base URL would become http:/ / app_name-namespace.rhcloud.com/ app_name. Sample Download (http:/ / sourceforge. net/ projects/ zkforge/ files/ Small Talks/ ZK Sandbox for OpenShift/ ?) the sample maven project named openshift_zksandbox.zip. Sandbox sample is deployed on OpenShift at http:/ / zksandbox-zksupport. rhcloud. com/ . Liferay 60 Liferay Setting up Liferay There 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: <?xml version="1.0"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <context-param> <param-name>company_id</param-name> <param-value>liferay.com</param-value> </context-param> <context-param> <param-name>root_path</param-name> <param-value>/myportal</param-value> </context-param> <filter> <filter-name>Auto Login Filter</filter-name> <filter-class>com.liferay.portal.servlet.filters.autologin.AutoLoginFilter</filter-class> Liferay 61 </filter> . . . 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): <Context path="/myportal" reloadable="true" > <Resource name="jdbc/LiferayPool" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
roleClassNames="com.liferay.portal.security.jaas.PortalRole" debug="99" useContextClassLoader="false" /> </Context> 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 <%= namespace %>loadPortlet() { var path = "/c/portal/render_portlet"; however it should look as follows: Liferay 62 function <%= namespace %>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. Deploying a ZK portlet Here, 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 63 package za.co.mypackage.portlet; import java.io.IOException; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.GenericPortlet; import javax.portlet.PortletException; import javax.portlet.PortletRequestDispatcher; import javax.portlet.RenderRequest; import 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 64 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: <?xml version="1.0"?> <!DOCTYPE display PUBLIC "-//Liferay//DTD Display 4.0.0//EN" "http://www.liferay.com/dtd/liferay-display_4_0_0.dtd"> <display> <category name="category.test"> <portlet id="portletone" /> Liferay 65 </category> </display> Now, also in the WEB-INF, create a file called 'liferay-portlet.xml' that looks like the following: <?xml version="1.0"?> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_4_1_0.dtd"> <liferay-portlet-app> <portlet> <portlet-name>portletone</portlet-name> <instanceable>true</instanceable> </portlet> <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper> <role-mapper> <role-name>guest</role-name> <role-link>Guest</role-link> </role-mapper> <role-mapper> <role-name>power-user</role-name> <role-link>Power User</role-link> </role-mapper> <role-mapper> <role-name>user</role-name> <role-link>User</role-link> </role-mapper> </liferay-portlet-app> Liferay 5.2.* : Liferay 5.2 adds cache filters to users' web.xml when deployed on the liferay server. These, however, blocks the zk javascript (*.js) communication. To avoid this, add the property "speed-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: <?xml version="1.0"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <portlet-name>portletone</portlet-name> <display-name>Sample JSP Portlet</display-name> <portlet-class>za.co.mypackage.JSPPortlet</portlet-class> <init-param> <name>view-jsp</name> Liferay 66 <value>/view.zul</value> </init-param> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> </supports> <portlet-info> <title>Sample JSP Portlet</title> <short-title>Sample JSP Portlet</short-title> <keywords>Sample JSP Portlet</keywords> </portlet-info> <security-role-ref> <role-name>guest</role-name> </security-role-ref> <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> </portlet> </portlet-app> 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 <web-app> add the following (followed by the typical ZK stuff): . . . <display-name>sample-jsp-portlet</display-name> <context-param> <param-name>company_id</param-name> <param-value>liferay.com</param-value> </context-param> <listener> <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class> </listener> . . . 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 67 Running ZK 5 with Liferay 5.2 Version: 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: <portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class> And create a zk_page called hello.zul .hello.zul <?xml version="1.0" encoding="UTF-8"?> <?page title="Hello"?> <zk> <window title="My First window" border="normal" width="200px"> Hello, World! <button label="Hi" onClick='alert("Welcome")'/> </window> </zk> portlet.xml <?xml version="1.0" encoding="UTF-8"?> <portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <description xml:lang="EN">HelloZK</description> <portlet-name>HelloZK</portlet-name> <display-name xml:lang="EN">HelloZK</display-name> <portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> </supports> <supported-locale>en</supported-locale> <portlet-info> <title>HelloZK Portlet</title> <short-title>HelloZK</short-title> <keywords>zk</keywords> </portlet-info> <portlet-preferences> <preference> <name>zk_page</name> <value>/hello.zul</value> </preference> </portlet-preferences> Liferay 68 <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> <security-role-ref> <role-name>administrator</role-name> </security-role-ref> </portlet> </portlet-app> liferay-display.xml <?xml version="1.0"?> <!DOCTYPE display PUBLIC "-//Liferay//DTD DISPLAY 2.0.0//EN" "http://www.liferay.com/dtd/liferay-display_2_0_0.dtd"> <display> <category name="category.sample"> <portlet id="HelloZK" /> </category> </display> liferay-portlet.xml <?xml version="1.0"?> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd"> <liferay-portlet-app> <portlet> <portlet-name>HelloZK</portlet-name> <header-portlet-javascript>/zkau/web/js/zk.wpd</header-portlet-javascript> </portlet> <role-mapper> <role-name>user</role-name> <role-link>User</role-link> </role-mapper> <role-mapper> <role-name>power-user</role-name> <role-link>Power User</role-link> </role-mapper> <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper> </liferay-portlet-app> liferay-plugin-package.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plugin-package PUBLIC "-//Liferay//DTD Plugin Package 4.3.6//EN" "http://www.liferay.com/dtd/liferay-plugin-package_4_3_0.dtd"> <plugin-package> Liferay 69 <name>Hello ZK</name> <module-id>/com/demo/test/hellozk/war</module-id> <types> <type>portlet</type> </types> <tags> <tag>Hello ZK</tag> </tags> <short-description> Hello ZK </short-description> <change-log> Initial Deployment </change-log> <author>Sam</author> <licenses> <license osi-approved="true">GPL</license> </licenses> <liferay-versions> <liferay-version>5.1.1+</liferay-version> <liferay-version>5.2.1+</liferay-version> </liferay-versions> </plugin-package> 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 <zk> . . . <library-property> <name>org.zkoss.zk.portlet.PageRenderPatch.class</name> <value>org.zkoss.zkplus.liferay.JQueryRenderPatch</value> </library-property> <library-property> <name>org.zkoss.zkplus.liferary.jQueryPatch</name> <value>500</value> </library-property> . . . </zk> Liferay 70 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] Running ZK 5 with Liferay 6 Version: Liferay: 6.0+ 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 web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>HelloZK2</display-name> <filter> <filter-name>Cache Filter - Resource</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.cache.CacheFilter</param-value> </init-param> <init-param> <param-name>url-regex-ignore-pattern</param-name> <param-value>.+/-/.+</param-value> </init-param> <init-param> <param-name>pattern</param-name> <param-value>2</param-value> </init-param> </filter> <filter> <filter-name>Cache Filter - Resource JSP</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.cache.CacheFilter</param-value> </init-param> <init-param> <param-name>url-regex-pattern</param-name> Liferay 71 <param-value>.+/(css|main)\.jsp</param-value> </init-param> <init-param> <param-name>pattern</param-name> <param-value>2</param-value> </init-param> </filter> <filter> <filter-name>ETag Filter</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.etag.ETagFilter</param-value> </init-param> <init-param> <param-name>url-regex-ignore-pattern</param-name> <param-value>.+/-/.+</param-value> </init-param> </filter> <filter> <filter-name>ETag Filter - JSP</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.etag.ETagFilter</param-value> </init-param> <init-param> <param-name>url-regex-pattern</param-name> <param-value>.+/(css|main)\.jsp</param-value> </init-param> </filter> <filter> <filter-name>GZip Filter</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.gzip.GZipFilter</param-value> </init-param> </filter> <filter> <filter-name>Header Filter</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.header.HeaderFilter</param-value> </init-param> Liferay 72 <init-param> <param-name>url-regex-ignore-pattern</param-name> <param-value>.+/-/.+</param-value> </init-param> <init-param> <param-name>Cache-Control</param-name> <param-value>max-age=315360000, public</param-value> </init-param> <init-param> <param-name>Expires</param-name> <param-value>315360000</param-value> </init-param> <init-param> <param-name>Vary</param-name> <param-value>Accept-Encoding</param-value> </init-param> </filter> <filter> <filter-name>Header Filter - JSP</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.header.HeaderFilter</param-value> </init-param> <init-param> <param-name>url-regex-pattern</param-name> <param-value>.+/(css|main)\.jsp</param-value> </init-param> <init-param> <param-name>Cache-Control</param-name> <param-value>max-age=315360000, public</param-value> </init-param> <init-param> <param-name>Expires</param-name> <param-value>315360000</param-value> </init-param> <init-param> <param-name>Vary</param-name> <param-value>Accept-Encoding</param-value> </init-param> </filter> <filter> <filter-name>Language Filter</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> Liferay 73 <param-value>com.liferay.portal.servlet.filters.language.LanguageFilter</param-value> </init-param> </filter> <filter> <filter-name>Minifier Filter</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.minifier.MinifierFilter</param-value> </init-param> </filter> <filter> <filter-name>Minifier Filter - JSP</filter-name> <filter-class>com.liferay.portal.kernel.servlet.PortalClassLoaderFilter</filter-class> <init-param> <param-name>filter-class</param-name> <param-value>com.liferay.portal.servlet.filters.minifier.MinifierFilter</param-value> </init-param> <init-param> <param-name>url-regex-pattern</param-name> <param-value>.+/(css|main)\.jsp</param-value> </init-param> </filter> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.ico</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.jpg</url-pattern> </filter-mapping> <filter-mapping> Liferay 74 <filter-name>Header Filter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Header Filter - JSP</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.gif</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.ico</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.jpg</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter</filter-name> <url-pattern>*.png</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ETag Filter - JSP</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Cache Filter - Resource</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> Liferay 75 <filter-mapping> <filter-name>Cache Filter - Resource</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Cache Filter - Resource</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Cache Filter - Resource JSP</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>GZip Filter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>GZip Filter</filter-name> <url-pattern>*.html</url-pattern> </filter-mapping> <filter-mapping> <filter-name>GZip Filter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>GZip Filter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Language Filter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Minifier Filter</filter-name> <url-pattern>*.css</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Minifier Filter</filter-name> <url-pattern>*.js</url-pattern> </filter-mapping> <filter-mapping> <filter-name>Minifier Filter - JSP</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> <listener> <description>ZK listener for session cleanup</description> <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class> Liferay 76 </listener> <listener> <listener-class>com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener</listener-class> </listener> <listener> <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class> </listener> <servlet> <description>ZK loader for ZUML pages</description> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <description>The asynchronous update engine for ZK</description> <servlet-name>auEngine</servlet-name> <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class> </servlet> <servlet> <servlet-name>dspLoader</servlet-name> <servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class> <init-param> <param-name>class-resource</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet> <servlet-name>HelloZK</servlet-name> <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class> <init-param> <param-name>portlet-class</param-name> <param-value>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet> <servlet-name>HelloZK2</servlet-name> <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class> <init-param> <param-name>portlet-class</param-name> <param-value>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</param-value> </init-param> Liferay 77 <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.zhtml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.svg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.xml2html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>*.mul</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>/zk/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>dspLoader</servlet-name> <url-pattern>*.dsp</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HelloZK</servlet-name> <url-pattern>/HelloZK/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HelloZK2</servlet-name> <url-pattern>/HelloZK2/*</url-pattern> </servlet-mapping> <session-config> <session-timeout>3</session-timeout> </session-config> <mime-mapping> <extension>doc</extension> Liferay 78 <mime-type>application/vnd.ms-word</mime-type> </mime-mapping> <mime-mapping> <extension>gif</extension> <mime-type>image/gif</mime-type> </mime-mapping> <mime-mapping> <extension>htm</extension> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> <extension>html</extension> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> <extension>jnlp</extension> <mime-type>application/x-java-jnlp-file</mime-type> </mime-mapping> <mime-mapping> <extension>jpeg</extension> <mime-type>image/jpeg</mime-type> </mime-mapping> <mime-mapping> <extension>jpg</extension> <mime-type>image/jpeg</mime-type> </mime-mapping> <mime-mapping> <extension>js</extension> <mime-type>application/x-javascript</mime-type> </mime-mapping> <mime-mapping> <extension>pdf</extension> <mime-type>application/pdf</mime-type> </mime-mapping> <mime-mapping> <extension>png</extension> <mime-type>image/png</mime-type> </mime-mapping> <mime-mapping> <extension>rar</extension> <mime-type>application/x-rar-compressed</mime-type> </mime-mapping> <mime-mapping> <extension>txt</extension> <mime-type>text/plain</mime-type> </mime-mapping> <mime-mapping> Liferay 79 <extension>xls</extension> <mime-type>application/vnd.ms-excel</mime-type> </mime-mapping> <mime-mapping> <extension>xml</extension> <mime-type>text/xml</mime-type> </mime-mapping> <mime-mapping> <extension>xul</extension> <mime-type>application/vnd.mozilla.xul-xml</mime-type> </mime-mapping> <mime-mapping> <extension>zhtml</extension> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> <extension>zip</extension> <mime-type>application/x-zip</mime-type> </mime-mapping> <mime-mapping> <extension>zul</extension> <mime-type>text/html</mime-type> </mime-mapping> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> <jsp-config> <taglib> <taglib-uri>http://liferay.com/tld/aui</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-aui.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://liferay.com/tld/portlet</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-portlet-ext.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://liferay.com/tld/security</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-security.tld</taglib-location> </taglib> <taglib> Liferay 80 <taglib-uri>http://liferay.com/tld/theme</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-theme.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://liferay.com/tld/ui</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location> </taglib> <taglib> <taglib-uri>http://liferay.com/tld/util</taglib-uri> <taglib-location>/WEB-INF/tld/liferay-util.tld</taglib-location> </taglib> </jsp-config> </web-app> zk.xml: use JQueryRenderCachedPatch <?xml version="1.0" encoding="UTF-8"?> <zk> <library-property> <name>org.zkoss.zk.portlet.PageRenderPatch.class</name> <value>org.zkoss.zkplus.liferay.JQueryRenderCachedPatch</value> </library-property> <library-property> <name>org.zkoss.zkplus.liferary.jQueryPatch</name> <value>1500</value> </library-property> </zk> [since 5.0.11] use NonRootContextJQueryRenderPatch instead of JQueryRenderCachedPatch if the home page of Liferay is not under the root(/) path <?xml version="1.0" encoding="UTF-8"?> <zk> <library-property> <name>org.zkoss.zk.portlet.PageRenderPatch.class</name> <value>org.zkoss.zkplus.liferay.NonRootContextJQueryRenderPatch</value> </library-property> <library-property> <name>org.zkoss.zkplus.liferary.jQueryPatch</name> <value>1500</value> </library-property> </zk> liferay-portlet.xml: add this to the setting <header-portlet-javascript>/zkau/web/js/zk.wpd</header-portlet-javascript> Liferay 81 <liferay-portlet-app> <portlet> <portlet-name>HelloZK2</portlet-name> <header-portlet-javascript>/zkau/web/js/zk.wpd</header-portlet-javascript> </portlet> <role-mapper> <role-name>user</role-name> <role-link>User</role-link> </role-mapper> <role-mapper> <role-name>power-user</role-name> <role-link>Power User</role-link> </role-mapper> <role-mapper> <role-name>administrator</role-name> <role-link>Administrator</role-link> </role-mapper> </liferay-portlet-app> liferay-display.xml <?xml version="1.0"?> <!DOCTYPE display PUBLIC "-//Liferay//DTD DISPLAY 2.0.0//EN" "http://www.liferay.com/dtd/liferay-display_2_0_0.dtd"> <display> <category name="category.sample"> <portlet id="HelloZK2" /> </category> </display> liferay-plugin-package.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plugin-package PUBLIC "-//Liferay//DTD Plugin Package 4.3.6//EN" "http://www.liferay.com/dtd/liferay-plugin-package_4_3_0.dtd"> <plugin-package> <name>Hello ZK2</name> <module-id>/com/demo/test/hellozk2/war</module-id> <types> <type>portlet</type> </types> <tags> <tag>Hello ZK2</tag> </tags> <short-description> Hello ZK2 </short-description> <change-log> Initial Deployment </change-log> Liferay 82 <author>Sam</author> <licenses> <license osi-approved="true">GPL</license> </licenses> <liferay-versions> <liferay-version>6.0.0+</liferay-version> <liferay-version>6.0.0+</liferay-version> </liferay-versions> </plugin-package> portlet.xml <?xml version="1.0" encoding="UTF-8"?> <portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <description xml:lang="EN">HelloZK2</description> <portlet-name>HelloZK2</portlet-name> <display-name xml:lang="EN">HelloZK2</display-name> <portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class> <expiration-cache>0</expiration-cache> <supports> <mime-type>text/html</mime-type> <portlet-mode>view</portlet-mode> </supports> <supported-locale>en</supported-locale> <portlet-info> <title>HelloZK2 Portlet</title> <short-title>HelloZK2</short-title> <keywords>zk2</keywords> </portlet-info> <portlet-preferences> <preference> <name>zk_page</name> <value>/hello.zul</value> </preference> </portlet-preferences> <security-role-ref> <role-name>power-user</role-name> </security-role-ref> <security-role-ref> <role-name>user</role-name> </security-role-ref> Liferay 83 <security-role-ref> <role-name>administrator</role-name> </security-role-ref> </portlet> </portlet-app> Please download the following war file to view this example in detail Download DEPLOY_TO__HelloZK2.war [4] See also http:/ / devenphillips. blogspot. com/ 2009/ 04/ developing-liferay-portlets-with-zk. html ZK 5 / Liferay Integration - jquery conflict [5] Version History Version 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 84 Pluto Deploy a ZK Porlet web.xml Define the definition of porlet in web.xml <web-app> <display-name>ZK Portlets</display-name>
<servlet> <description>ZK loader for ZUML pages</description> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup><!-- Must --> </servlet>
<security-role-ref> <role-name>plutoTestRole</role-name> <role-link>tomcat</role-link> </security-role-ref> </portlet> </portlet-app> How to resolve Session Timeout The 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 <system-config> <cache-provider-class>org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider</cache-provider-class> </system-config> Version History Version Date Content Jetty 87 Jetty 1. Download Jetty from http:/ / www. mortbay. org/ jetty/ index. html and install it, if you haven't installed it yet. 2. Stop Jetty. 3. Unzip zk-demo-x.x.x.zip or zk-demo.x.x.tar.gz 4. 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 History Version Date Content Resin 1. Download Resin from http:/ / caucho. com/ download/ index. xtp and install it, if you haven't installed it yet. 2. Stop Resin 3. Unzip zk-1.0.0.zip or zk-1.0.0.tar.gz 4. Copy dist/lib/*.jar to $RESIN_HOME/lib ($RESIN_HOME is where you installed Resin.) 5. Copy dist/lib/ext/*.jar to $RESIN_HOME/lib 6. [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 History Version Date Content Setting up OSGi 88 Setting up OSGi This installation guide will lead you through how to run ZK in OSGi environment. If you are not familiar to OSGi, following are some useful references: OSGi official home page [1] OSGi Service Platform Release 4 [2] OSGI Service Platform Release 4 Java API [3] Hello, OSGi Part 1 [4] , Part 2 [5] , Part 3 [6] Apache Felix OSGi Tutorial [7] References [1] http:/ / www. osgi. org/ Main/ HomePage [2] http:/ / www2.osgi. org/ Release4/ HomePage [3] http:/ / www2.osgi. org/ javadoc/ r4/ [4] http:/ / www. javaworld. com/ javaworld/ jw-03-2008/ jw-03-osgi1. html [5] http:/ / www. javaworld. com/ javaworld/ jw-04-2008/ jw-04-osgi2. html [6] http:/ / www. javaworld. com/ javaworld/ jw-06-2008/ jw-06-osgi3. html [7] http:/ / felix.apache.org/ site/ apache-felix-osgi-tutorial. html EclipseRT Web Starter Kits Prepare OSGi running environment EclipseRT Web Starter Kit Download EclipseRT Web Starter Kits [1] . Click the latest stable version (currently 3.7.1.201109140245) link and download Jetty Server (cross platform) and unzip the file. Rename the unzipped folder name from EclipseRTWebStarterKit-version.timestamp to EclipseRTWebStarterKit. Import this project to Eclipse by Import wizard: General -> Existing Projects into Workspace as illustrated below. EclipseRT Web Starter Kits 89 ZK OSGi bundles since 6.0.2 Download ZK OSGi [2] jars. Unzip all zk osgi jars into any folder. Double click EclipseRTWebStarterKit.target file. Click Add button -> choose Directory -> Select the folder that contains zk osgi jars. Click Set as Target Platform link to make it a default target platform to run OSGi Framework. EclipseRT Web Starter Kits 90 Run up OSGi environment Right Click EclipseRTWebStarterKit project -> Run As -> Run Configuration -> OSGi Framework -> Start EclipseRT Web Starter Kit Click Add Required Bundles button-> click Run button. If you see osgi console, then it is correctly installed. You can type help command to check all osgi command usage. Type close command in the console to shutdown and exit OSGi environment. EclipseRT Web Starter Kits 91 Create a Hello World project Follow eclipse wizard to create a new Plug-in project 1. File -> New -> Other -> Plug-in Project 2. Type the project name (here I use helloZKOSGi) and in the Target Platform choose an OSGi framework as standard and click Next. 3. In Properties panel, type ID (helloZKOSGi), Version (1.0.0), Name (Hello ZK OSGi) and Provider (leave blank) information. In Options panel, uncheck Generate an activator since we do not need Activator here. Then, click Next. 4. Uncheck Create a plug-in using one of the templates since we do not need it here. Click Finish. Create a folder called WEB-INF under the project root. Create web.xml file under WEB-INF folder. Create zk.xml file under WEB-INF folder. Create a hello world zul page under project root. <?page title="Hello ZK OSGi"?> <window title="Hello OSGi!!" border="normal" width="200px"> <label value="You are using: ${desktop.webApp.version}"/> </window> Open MANIFEST.MF file to edit necessary information. 1. You will see six tabs: Overview, Dependencies, Runtime, Build, MANIFEST.MF and build.properties. 2. In Dependencies tab, add Required Plug-ins for all zk jars 4. In Build tab, remember to check WEB-INF folder and index.zul file that were created earlier. EclipseRT Web Starter Kits 92 6. In MANIFEST.MF tab, add the following content to the last line that will treat this plug-in project as a web bundle. Web-ContextPath: /osgi Right click on helloZKOSGi project -> Run AS -> Run Configuration Click Add Required Bundles button and make sure that helloZKOSGi bundle is checked Visit http:/ / localhost:8080/ osgi to check the result. Version History Version Date Content References [1] http:/ / download. eclipse.org/ jetty/ updates/ jetty-rt-3. 7milestones/ [2] http:/ / sourceforge. net/ projects/ zk1/ files/ ZK/ zk-6. 0. 2/ Setting up OS 93 Setting up OS Here is the information related to the OS environment that some ZK components might depend on. Linux Here is the notes to set up the environment of Linux that some ZK components depends on. Chart and Captcha Chart 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. Jaspserreport Jasperreprot 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 History Version Date Content IOS 94 IOS Here is the notes to set up the environment of iOS. Columns Menu Several 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: <meta name="viewport" content="width=1190" > For more information, please refer to Safari Developer Library [1] . onClick Event In IOS device (ipad/iphone) you have to specify the following CSS (cursor:pointer) to make it work with onClick event. <component style="cursor:pointer"> Version History Version Date Content IOS 95 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 Studio Install Eclipse 1. 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 Studio Follow ZK Studio Installation Guide to install ZK Studio. Defining a Server Runtime Before 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. From menu goto Windows > Preferences... 2. Select Server > Runtime Environments, then click Add 3. Select Apache > Apache Tomcat v6.0 and click Next 4. 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 96 Create and Run Your First ZK Application After installing Eclipse and ZK Studio, please take a look at Create and Run Your First ZK Application with Eclipse and ZK Studio. Version History Version Date Content Eclipse without ZK Studio Prepare Eclipse Install Eclipse 1. 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 Studio Here 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 Eclipse 1. You should have setup Eclipse to work with ZK. The details is in the above smalltalk. 2. Execute the Eclipse SDK. 3. Select Window/Preferences... from the menu and the Preferences dialog popup. 4. 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 97 How to generate ZUL files from the ZUL schema using Eclipse 1. You should have setup the zul.xsd schema into Eclipse. 2. Select File/New/Other... from the Eclipse SDK menu and the New dialog popup. 3. In Select a wizard page, select XML/XML from the tree menu and press Next > button. 4. In Create XML File page, select Create XML file from an XML schema file and then press Next > button. 5. 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 Manually Instead 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. <zk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul/zul.xsd"> ... </zk> 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 zhtml 1. 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 98 How to setup the Rational Application Developer RAD version of Eclipse to work with zhtml 1. Select Window/Preferences... from the SDK menu and the Preferences dialog will popup. 2. Select Workbench/File Assocations then click on the top Add to add a file type *.zhtml 3. Click on the lower Add and select HTML Source Page Editor and set it to be default 4. Done See Also Develop ZK Applications with Eclipse [2] Version History Version Date Content References [1] http:/ / www. zkoss.org/ product/ zkstudio. dsp [2] http:/ / www. zkoss.org/ smalltalks/ eclipse/ ek.html Maven If 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 Eclipse 99 Setting up Maven on Eclipse Setting up on Eclipse Here describes how to set up Maven [2] 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 [1] Choose Eclipse IDE for Java EE Developers (It included WTP [2] ) 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 [3] : Update Site : Eclipse 3.6.* and 3.7.*: http:/ / download. eclipse. org/ technology/ m2e/ releases [4] (Recommend) Eclipse 3.5.* and 3.6.*: http:/ / m2eclipse. sonatype. org/ sites/ m2e [5] (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/ [6] 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 [7] 3. (Optional) M2eclipse Extra [8] Update Site : http:/ / m2eclipse. sonatype. org/ sites/ m2e-extras [9] Install Maven Integration for WTP Setting up Maven on Eclipse 100 4. (Optional) Eclipse IAM, formerly Q for Eclipse: Eclipse Integration for Apache Maven Q4e on Google Code [10] 5. (Optional) Subeclipse Get the latest subclipse plug-in as per plug-in instructions here [11] (use this http:/ / subclipse. tigris. org/ update_1. 6. x) Note: For 64-bit Windows & 64-bit Eclipse installation you will need to install Silksvn client download [12] to avoid JavaHL binding error. [1] http:/ / www. eclipse.org/ downloads [2] http:/ / www. eclipse.org/ webtools/ [3] 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) [4] http:/ / download. eclipse.org/ technology/ m2e/ releases [5] http:/ / m2eclipse.sonatype.org/ sites/ m2e [6] http:/ / run-jetty-run. googlecode.com/ svn/ trunk/ updatesite/ [7] http:/ / code. google. com/ p/ run-jetty-run/ wiki/ GettingStarted [8] This plugin should be installed when you use WTP as your development server. [9] http:/ / m2eclipse.sonatype.org/ sites/ m2e-extras [10] http:/ / code.google. com/ p/ q4e/ [11] http:/ / subclipse.tigris. org/ install.html [12] http:/ / www.sliksvn. com/ en/ download Version History Version Date Content Resolving ZK Framework Artifacts via Maven 101 Resolving ZK Framework Artifacts via Maven How to Use ZK Maven Repository This 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. Add ZK Maven repository to your pom.xml file By default while resolving project dependencies Maven will only look into Maven central repository [1]. In order to use ZK Maven repository add following <repositories> element into pom.xml under the root <project> element. <repositories> <repository> <id>ZK CE</id> <name>ZK CE Repository</name> <url>http://mavensync.zkoss.org/maven2</url> </repository> </repositories> Note that ZK Maven repository URL is http:/ / mavensync. zkoss. org/ maven2 [2] . Adding ZK library dependencies Depending 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 [2] Here is how you can declare a dependency for main ZK library and zul library for your project. <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkbind</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zul</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkplus</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zhtml</artifactId> <version>6.0.0</version> </dependency> Resolving ZK Framework Artifacts via Maven 102 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.xml Here is sample pom.xml for a simple Java project that uses the ZK maven repository. <?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>zk.app</groupId> <artifactId>MyZKMavenApp</artifactId> <version>0.0.1-SNAPSHOT</version> <repositories> <repository> <id>ZK CE</id> <name>ZK CE Repository</name> <url>http://mavensync.zkoss.org/maven2</url> </repository> <repository> <id>ZK EVAL</id> <name>ZK Evaluation Repository</name> <url>http://mavensync.zkoss.org/eval</url> </repository> </repositories> <dependencies> .... </dependencies> </project> Sample of Dependencies ZK CE <dependencies> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkplus</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zhtml</artifactId> <version>6.0.0</version> </dependency> Resolving ZK Framework Artifacts via Maven 103 <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkbind</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zul</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> </dependencies> ZK PE <dependencies> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkplus</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zhtml</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkbind</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkex</artifactId> Resolving ZK Framework Artifacts via Maven 104 <version>6.0.0</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> </dependencies> ZK EE <dependencies> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkplus</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zhtml</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkbind</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.zkoss.zk</groupId> <artifactId>zkmax</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> Resolving ZK Framework Artifacts via Maven 105 <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> </dependencies> Download / Customize pom.xml Download directly Download Latest CE pom.xml [3] Download Latest PE pom.xml [4] (Evaluation Only) Download Latest EE pom.xml [5] (Evaluation Only) Customize your own pom.xml ZK POM Customizer [6] Resolving ZK Framework Artifacts via Maven 106 How to Choose the Right ZK Maven Repository for a ZK Package ZK 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 edition Here 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 [7] . Add to your Maven projects Choose the edition you want and add to you Super POM [8] 1. CE (Freely avaialable under LGPL) http:/ / mavensync. zkoss. org/ maven2 Sample Config <repositories> <repository> <id>ZK CE</id> <url>http://mavensync.zkoss.org/maven2</url> </repository> </repositories> 2. PE-eval / EE- eval (60-days free evaluation) http:/ / mavensync. zkoss. org/ eval/ Sample Config <repositories> <repository> <id>ZK PE/EE Evaluation</id> <url>http://mavensync.zkoss.org/eval/</url> </repository> </repositories> 3. PE / EE (premium users only) Notice : Need Login authentication If you are our customer or ZOL licensed user you can apply for a premium account to use ZK PE/EE maven repository. To use ZK PE/EE maven files you have to add both CE and EE repositories as illustrated as follows, http:/ / mavensync. zkoss. org/ maven2 https:/ / maven. zkoss. org/ repo/ zk/ ee Sample Config <repositories> <repository> <id>ZK CE</id> <url>http://mavensync.zkoss.org/maven2</url> Resolving ZK Framework Artifacts via Maven 107 </repository> <repository> <id>ZK EE</id> <url>https://maven.zkoss.org/repo/zk/ee</url> </repository> </repositories> Login authentication According to the official doc [9] 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 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>ZK EE</id><!-- Same as your repository name --> <!-- Your premium user name and password --> <username>ryanwu</username> <password>2k055ecret</password> </server> </servers> </settings> Summary of JAR files There're something you need to know about ZK's edition and package(s). CE PE EE Description zk.jar V V V ZK core functions, such as ZK Loader and Update Engine. zul.jar V V V ZK XUL components (http://www.zkoss.org/2005/zul) zhtml.jar V V V ZK XHTML components (http://www.w3c.org/1999/xhtml) zcommon.jar V V V The common library that ZK depends on zcommons-el.jar V V V ZK EL expressions zweb.jar V V V The Web library that ZK depends on zkplus.jar V V V ZK extra utilities integrated easily with other frameworks. zkex.jar V V ZK additional components and features for PE zkmax.jar V ZK additional components and features for EE zml.jar V (only ZK 3) V V ZK XML components for generating XML output This will be helpful when you modify your dependencies of projects. 'Italic text' Resolving ZK Framework Artifacts via Maven 108 Version History Version Date Content References [1] http:/ / repo1.maven. org/ maven2 [2] http:/ / mavensync.zkoss. org/ maven2 [3] http:/ / www. zkoss.org/ services/ maven/ zk/ ?d=true& l=0& v=latest [4] http:/ / www. zkoss.org/ services/ maven/ zk/ ?d=true& l=1& v=latest [5] http:/ / www. zkoss.org/ services/ maven/ zk/ ?d=true& l=2& v=latest [6] http:/ / www. zkoss.org/ services/ maven/ zk/ [7] http:/ / www. zkoss.org/ product/ edition.dsp [8] http:/ / www. sonatype. com/ books/ mvnref-book/ reference/ pom-relationships-sect-pom. html#pom-relationships-sect-super-pom [9] http:/ / maven. apache. org/ settings. html#Servers XML Editor If 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. <zk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul/zul.xsd"> ... </zk> 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 History Version Date Content Article Sources and Contributors 109 Article Sources and Contributors ZK 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 Eclipse and Maven Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Quick_Start/Create_and_Run_Your_First_ZK_Application_with_Eclipse_and_Maven Contributors: Alicelin, Jimmyshiau, Southerncrossie, 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, Jumperchen, 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, Jimmyshiau, 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, Jeanher, Tomyeh JBoss Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/JBoss Contributors: Char, Jimmyshiau, Tomyeh JBoss Cluster Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/JBoss_Cluster Contributors: Jeanher, Vincent WebSphere Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebSphere Contributors: Alicelin, Samchuang, Tomyeh WebSphere Portal Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/WebSphere_Portal Contributors: Jeanher, Vincent 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, Jeanher, Jimmyshiau, Peterkuo, Southerncrossie, Tomyeh Heroku Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Heroku Contributors: Jeanher, Southerncrossie, Vincent Red Hat OpenShift Express Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Red_Hat_OpenShift_Express Contributors: Jeanher, Southerncrossie, Vincent Liferay Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_Servers/Liferay Contributors: Alicelin, Benbai, 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 OSGi Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_OSGi Contributors: Southerncrossie, Vincent EclipseRT Web Starter Kits Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_OSGi/EclipseRT_Web_Starter_Kits Contributors: Southerncrossie, Vincent 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 Eclipse Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Setting_up_Maven_on_Eclipse Contributors: Jimmyshiau Article Sources and Contributors 110 Resolving ZK Framework Artifacts via Maven Source: http://new.zkoss.org/index.php?title=ZK_Installation_Guide/Setting_up_IDE/Maven/Resolving_ZK_Framework_Artifacts_via_Maven Contributors: Alicelin, Ashishd, Char, Flyworld, Jeanher, Jimmyshiau, 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 111 Image Sources, Licenses and Contributors Image: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: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 File:ZK_Installation_Guide_Quick_Start_Create_and_Run_with Eclipse_and_Maven.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Create_and_Run_with_Eclipse_and_Maven.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_New_project-01.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_New_project-01.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Maven_Archetype_step1.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Maven_Archetype_step1.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_New_project-02.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_New_project-02.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_New_project-03.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_New_project-03.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_New_project-04.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_New_project-04.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_run_project-01.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_run_project-01.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_run_project-02.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_run_project-02.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_maven_Archetype_pak1.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_maven_Archetype_pak1.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_package_project.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_package_project.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_Quick_Start_Maven_import.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_Quick_Start_Maven_import.png License: unknown Contributors: Jimmyshiau 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://new.zkoss.org/index.php?title=File:ZKInstallationGuide_NetBeans_RunZKDemo.png License: unknown Contributors: Sphota File:J2EEWebApplication.jpg Source: http://new.zkoss.org/index.php?title=File:J2EEWebApplication.jpg License: unknown Contributors: Flyworld File:wb7-step1-installApplication.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step1-installApplication.png License: unknown Contributors: Samchuang File:wb7-step2-importWarFile.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step2-importWarFile.png License: unknown Contributors: Samchuang File:wb7-step3-fastPath.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step3-fastPath.png License: unknown Contributors: Samchuang File:wb7-step4-goThroughSteps-setRoot.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step4-goThroughSteps-setRoot.png License: unknown Contributors: Samchuang File:wb7-step5-save.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step5-save.png License: unknown Contributors: Samchuang File:wb7-step6-startApplication.png Source: http://new.zkoss.org/index.php?title=File:Wb7-step6-startApplication.png License: unknown Contributors: Samchuang File:wb7-checkApplicationPort-1.png Source: http://new.zkoss.org/index.php?title=File:Wb7-checkApplicationPort-1.png License: unknown Contributors: Samchuang File:wb7-checkApplicationPort-2.png Source: http://new.zkoss.org/index.php?title=File:Wb7-checkApplicationPort-2.png License: unknown Contributors: Samchuang File:wb7-checkApplicationPort-3.png Source: http://new.zkoss.org/index.php?title=File:Wb7-checkApplicationPort-3.png License: unknown Contributors: Samchuang File:wb7-zkdemo.png Source: http://new.zkoss.org/index.php?title=File:Wb7-zkdemo.png License: unknown Contributors: Samchuang File:websphere01.png Source: http://new.zkoss.org/index.php?title=File:Websphere01.png License: unknown Contributors: Vincent File:websphere07.png Source: http://new.zkoss.org/index.php?title=File:Websphere07.png License: unknown Contributors: Vincent File:websphere08.png Source: http://new.zkoss.org/index.php?title=File:Websphere08.png License: unknown Contributors: Vincent File:ZK_Installation_Guide_WebLogic_Portal_01.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_01.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_02.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_02.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_03.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_03.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_04.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_04.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_05.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_05.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_06.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_06.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_07.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_07.png License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_WebLogic_Portal_08.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_WebLogic_Portal_08.png License: unknown Contributors: Jimmyshiau Image:eclipse_osgi01.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi01.png License: unknown Contributors: Vincent Image:eclipse_osgi02.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi02.png License: unknown Contributors: Vincent Image:eclipse_osgi05.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi05.png License: unknown Contributors: Vincent Image:eclipse_osgi06.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi06.png License: unknown Contributors: Vincent Image Sources, Licenses and Contributors 112 Image:eclipse_osgi07.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi07.png License: unknown Contributors: Vincent Image:eclipse_osgi08.png Source: http://new.zkoss.org/index.php?title=File:Eclipse_osgi08.png License: unknown Contributors: Vincent File:install_ios_viewpoint.jpg Source: http://new.zkoss.org/index.php?title=File:Install_ios_viewpoint.jpg License: unknown Contributors: Jimmyshiau File:ZK_Installation_Guide_m2e.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_m2e.png License: unknown Contributors: Flyworld File:ZK_Installation_Guide_m2e_extra.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_m2e_extra.png License: unknown Contributors: Flyworld File:ZK_Installation_Guide_pomgenerator.png Source: http://new.zkoss.org/index.php?title=File:ZK_Installation_Guide_pomgenerator.png License: unknown Contributors: Flyworld