Tomcat"

From Documentation
m
Line 14: Line 14:
 
#: Here we use '''Apache-tomcat-6.0.29'''
 
#: Here we use '''Apache-tomcat-6.0.29'''
 
#* Any download/install problem, please refer to http://tomcat.apache.org/tomcat-6.0-doc/index.html
 
#* Any download/install problem, please refer to http://tomcat.apache.org/tomcat-6.0-doc/index.html
 +
=Deploy=
  
=Test drive with the ZK demo application=
+
==Deploy your first application==
 +
We created a simple ZK war file in previous chapter - [[ZK_Installation_Guide/Before_You_Start/Create_Your_First_ZK_Application|Create Your First ZK Application]]
  
The simplest way to test drive ZK is to download and install the ZK demo application.
+
*Now deploy it to you web container.
 +
*# Copy '''myZK.war''' to $TOMCAT_HOME<ref>Default : C:\Program Files\Apache Software Foundation\Tomcat 6.0</ref>\webapps
 +
*# Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.)
 +
*#Then, you can see the result by visiting <tt>http://localhost:8080/myZK/hello.zul</tt><ref>Tomcat services' default port is 8080</ref>.
  
This step is optional. You could skip it if you prefer to start creating your own application directly.
+
[[Image:dgGettingStartedHello.zul.png]]
 
 
# Download at http://sourceforge.net/projects/zk1/files/ZK/zk-5.0.4/zk-demo-5.0.4.zip/download<ref>It is recommended to visit http://www.zkoss.org/download/zk.dsp for the most updated version.</ref>
 
# Unzip zk-demo-5.0.4.zip
 
# Copy zkdemo.war under the zk-demo-5.0.4 directory to $TOMCAT_HOME/webapps. $TOMCAT_HOME is the directory you installed Tomcat, for example, C:\Program Files\Apache Software Foundation\Tomcat 6.0.
 
# Then, you could visit http://localhost:8080/zkdemo, and then play around with the demo application
 
  
 
<blockquote>
 
<blockquote>
Line 30: Line 30:
 
<references/>
 
<references/>
 
</blockquote>
 
</blockquote>
 +
==Deploy ZK demo application(optional)==
  
=Create your first application=
+
The simplest way to test drive ZK existed application is to download and install the ZK demo application.
  
Here is how to create a Web application manually without IDE or other tools. It is easy to find the similar procedure with your preferred IDE or tools, such as Eclipse and NetBeans.
+
''This step is optional. You could skip it if you prefer to start creating your own application directly.''
  
==Download ZK==
+
# Download lastest zkdemo at http://sourceforge.net/projects/zk1/files/ZK/ (e.g. zk-demo-5.0.4.zip)
 
+
# Unzip zk-demo-5.0.4.zip
First, download the ZK libraries from http://www.zkoss.org/download/zk.dsp and save it to a proper location.
+
# Copy '''zkdemo.war''' under the <u>zk-demo-5.0.4</u> directory to $TOMCAT_HOME/webapps.
 
+
# Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.)
==Create a Web application==
+
# Visit http://localhost:8080/zkdemo, and then play around with the demo application
 
 
Creating a Web application in Tomcat is easy: just create a directory under $TOMCAT_HOME/webapps.  $TOMCAT_HOME is the directory you installed Tomcat, for example, C:\Program Files\Apache Software Foundation\Tomcat 6.0.
 
 
 
Let us assume the application is called myZK. Then, the directory structure shall be as follows.
 
 
 
:myZK
 
::WEB-INF
 
::WEB-INF/lib
 
 
 
==Deploy ZK libraries==
 
 
 
# Unzip zk-bin-5.0.4.zip
 
# Copy JAR files under dist/lib to $TOMCAT_HOME/webapps/myZK/WEB-INF/lib
 
 
 
==Create web.xml==
 
 
 
Create web.xml under $TOMCAT_HOME/webapps/myZK/WEB-INF. For the content of web.xml, please refer to [[ZK_Installation_Guide/Before_You_Start/Sample of web.xml|Sample of web.xml]].
 
 
 
For older Tomcat (4.x) that supports only Servlet 2.3, please refer to [[ZK_Installation_Guide/Before_You_Start/Sample of web.xml for Servlet 2.3|Sample of web.xml for Servlet 2.3]].
 
 
 
=Create your application=
 
 
 
After setting up web.xml, it is ready to serve your application.
 
 
 
For example, we can create a simple page, say, hello.zul with the following content.
 
 
 
<syntax lang="xml">
 
<window title="My First ZK Application" border="normal">
 
Hello World!
 
</window>
 
</syntax>
 
 
 
Then, you can see the result by visiting <tt>http://localhost:8080/myZK/hello.zul</tt><ref>Assumes Tomcat's port is 8080 and started.</ref>.
 
 
 
[[Image:dgGettingStartedHello.zul.png]]
 
  
 
<blockquote>
 
<blockquote>

Revision as of 09:21, 21 September 2010


Environment

  • OS
    Windows XP SP3
  • Java
    JDK 6ux21 x86
  • Web container
    Apache-tomcat-6.0.29.exe
  • Browser
    Internet Explorer 6

Install Tomcat

  1. Visit Tomcat Official Site
  2. Select the correct binary distribution for your environment and download
    Here we use Apache-tomcat-6.0.29

Deploy

Deploy your first application

We created a simple ZK war file in previous chapter - Create Your First ZK Application

  • Now deploy it to you web container.
    1. Copy myZK.war to $TOMCAT_HOME[1]\webapps
    2. Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.)
    3. Then, you can see the result by visiting http://localhost:8080/myZK/hello.zul[2].

DgGettingStartedHello.zul.png


  1. Default : C:\Program Files\Apache Software Foundation\Tomcat 6.0
  2. Tomcat services' default port is 8080

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 lastest zkdemo at http://sourceforge.net/projects/zk1/files/ZK/ (e.g. zk-demo-5.0.4.zip)
  2. Unzip zk-demo-5.0.4.zip
  3. Copy zkdemo.war under the zk-demo-5.0.4 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

Version History

Version Date Content
5.0.4 9/21/2010 Updated



Last Update : 2010/09/21

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