Tomcat"

From Documentation
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{ZKInstallationGuidePageHeader}}
 
{{ZKInstallationGuidePageHeader}}
 
 
=Install Tomcat=
 
=Install Tomcat=
 +
#Visit [http://tomcat.apache.org/ Tomcat Official Site]
 +
#Select the correct binary distribution for your environment and download
 +
#* For Windows, you might download and execute [http://apache.stu.edu.tw//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.exe 32-bit/64-bit Windows Service Installer], and then follow the instructions
 +
#* Any download/install problem, please refer to http://tomcat.apache.org/tomcat-6.0-doc/index.html
  
* First, visit http://tomcat.apache.org/download-60.cgi
+
=Deploy=
* Second, select the correct binary distribution for your environment.
 
** Windows users could select "32-bit/64-bit Windows Service Installer" and then follow its instructions.
 
  
=Test drive with the ZK demo application=
+
==Deploy ZK demo application(optional)==
  
The simplest way to test drive ZK is to download and install the ZK demo application.
+
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.
+
''This step is optional. You could skip it if you prefer to start creating your own application directly.''
  
# 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>
+
# Download the lastest zkdemo at http://sourceforge.net/projects/zk1/files/ZK/ (e.g. zk-sandbox-6.0.0.zip)
# Unzip zk-demo-5.0.4.zip
+
# Unzip zk-sandbox-6.0.0.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.
+
# Copy '''zkdemo.war''' under the <u>zk-sandbox-6.0.0</u> directory to $TOMCAT_HOME/webapps.
# Then, you could visit http://localhost:8080/zkdemo, and then play around with the demo application
+
# Start/ReStart the tomcat services (In some cases, you may need to restart your container if it is running.)
 +
# Visit http://localhost:8080/zkdemo, and then play around with the demo application
  
 
<blockquote>
 
<blockquote>
 
----
 
----
<references/>
+
Deploy war file to Tomcat is very easy but there're something you need to know
 +
*Tomcat will unzip the war file to <u>filename\</u> directory automatically
 +
*You can ''NOT'' modify the content of <u>filename\</u> 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
 
</blockquote>
 
</blockquote>
  
=Create your first application=
+
==Deploy your application with IDE==
 
 
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.
 
 
 
==Download ZK==
 
 
 
First, download the ZK libraries from http://www.zkoss.org/download/zk.dsp and save it to a proper location.
 
 
 
==Create a Web 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]].
 
 
 
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]].
 
 
 
=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.
+
When developing an application, we usually use IDE to deploy it. For more information, please refer to the document of your IDE.
  
<syntax lang="xml">
+
If you are new to Java IDE, you might take a look at [[ZK_Installation_Guide/Setting_up_IDE/Eclipse_with_ZK_Studio|Setting up Eclipse with ZK Studio]].
<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>
 
----
 
<references/>
 
</blockquote>
 
  
 
=Version History=
 
=Version History=
 
+
{{LastUpdated}}
 
{| border='1px' | width="100%"
 
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
! Version !! Date !! Content

Latest revision as of 01:58, 21 March 2012


Install Tomcat

  1. Visit Tomcat Official Site
  2. Select the correct binary distribution for your environment and download

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

Last Update : 2012/03/21


Version Date Content
     



Last Update : 2012/03/21

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