Setting Up Environment"

From Documentation
 
(6 intermediate revisions by the same user not shown)
Line 21: Line 21:
  
 
There are several files inside the sample project that require to explain:
 
There are several files inside the sample project that require to explain:
* /WEB-INF/web.xml
+
 
*: This web descriptor contains minimum configuration to run Spreadsheet.
+
* '''/WEB-INF/web.xml'''
* /WEB-INF/lib
+
This web descriptor contains minimum configuration to run Spreadsheet.
*: All jar files required to run Spreadsheet are here. You should see zss.jar in it.
+
 
* /index.zul
+
 
*: The page that uses Spreadsheet, and you can learn the basic usage and configuration.
+
* '''/WEB-INF/lib'''
* org.zkoss.zss.example.startzss.MyComposer.java
+
All jar files required to run Spreadsheet are here. You should see zss.jar in it.
*: The controller of Spreadsheet component in index.zul. It's the place where you write codes to control Spreadsheet.
+
 
 +
 
 +
* '''/index.zul'''
 +
The page that uses Spreadsheet, and you can learn the basic usage and configuration.
 +
 
 +
<source lang='xml' high='1'>
 +
<window title="My First ZK Spreadsheet Application" apply="org.zkoss.zss.essential.MyComposer"
 +
border="normal" vflex="1" width="100%">
 +
<spreadsheet src="/WEB-INF/book/startzss.xlsx" vflex="1" width="100%"
 +
maxVisibleRows="150" maxVisibleColumns="40"
 +
showToolbar="true" showSheetbar="true" showFormulabar="true"/>
 +
</window>
 +
</source>
 +
* Line 1: We assign a controller in <tt>apply</tt> attribute to control ''Window'' and its child component.  
 +
 
 +
 
 +
* '''org.zkoss.zss.example.startzss.MyComposer.java'''
 +
This class is a controller where we can write codes to control Spreadsheet e.g. listening Spreadsheet's events, or get an object of <javadoc>org.zkoss.zss.ui.Spreadsheet</javadoc>. For complete explanation, please refer to [[ZK Developer%27s Reference/MVC/Controller/Composer]]
  
 
= Prepare a Maven Project =
 
= Prepare a Maven Project =
* download sample maven project
+
If you want to create a Maven project, you can [http:// download our sample Maven project] to avoid creating from scratch.
* explain dependency
+
 
* reference other steps in creating a dynamic web project
+
If you use Compact Edition (CE) The main dependency in the sample project is <tt>org.zkoss.zss:zss</tt>:
 +
 
 +
<source lang='xml'>
 +
 
 +
<dependency>
 +
<groupId>org.zkoss.zss</groupId>
 +
<artifactId>zss</artifactId>
 +
<version>${zss.version}</version>
 +
</dependency>
 +
 
 +
</source>
 +
* <tt>${zss.version}</tt> can be 3.0.0 or above.
  
 +
If you want to use Enterprise Edition (EE), you should replace <tt>org.zkoss.zss:zss</tt> with <tt>org.zkoss.zss:zssex</tt> and add <tt>org.zkoss.zk:zkmax</tt>.
 +
<source lang='xml'>
  
= Then What ? =
+
<dependency>
 +
<groupId>org.zkoss.zss</groupId>
 +
<artifactId>zssex</artifactId>
 +
<version>${zss.version}</version>
 +
</dependency>
 +
<dependency>
 +
<groupId>org.zkoss.zk</groupId>
 +
<artifactId>zkmax</artifactId>
 +
<version>${zk.version}</version>
 +
</dependency>
 +
</source>
 +
* If <tt>${zss.version}</tt> is 3.0.0 or above, <tt>${zk.version}</tt> should be 6.5.2.
  
According to your requirement,
+
Except there is no JAR under /WEB-INF/lib, the rest are the same as dynamic web project. Please read previous paragraph about explanation of web.xml, index.zul and MyComposer.java.

Latest revision as of 01:54, 2 July 2013


Setting Up Environment





The purpose of this section is to tell you how to prepare an environment for working with Spreadsheet in API.

Prerequisites

Before developing a web application with Spreadsheet, you should prepare the following softwares:

  • Install JDK 1.5 or above
  • Install an application server
    • You can install any JavaEE application server you like. If you don't have one, Tomcat is a good choice.
  • Install Eclipse or other development tool.
    • In this book, we will use Eclipse as the default IDE to explain related setup.

Prepare a Dynamic Web Project

To save your time from creating a project out of nothing, you could just download the sample project which is a ready-to-run Eclipse dynamic web project. Even if you insist to create a project by your own, you still can reference the sample project.

There are several files inside the sample project that require to explain:

  • /WEB-INF/web.xml

This web descriptor contains minimum configuration to run Spreadsheet.


  • /WEB-INF/lib

All jar files required to run Spreadsheet are here. You should see zss.jar in it.


  • /index.zul

The page that uses Spreadsheet, and you can learn the basic usage and configuration.

	<window title="My First ZK Spreadsheet Application" apply="org.zkoss.zss.essential.MyComposer"
		border="normal" vflex="1" width="100%">
		<spreadsheet src="/WEB-INF/book/startzss.xlsx" vflex="1" width="100%"
		maxVisibleRows="150" maxVisibleColumns="40"
		 showToolbar="true" showSheetbar="true" showFormulabar="true"/>
	</window>
  • Line 1: We assign a controller in apply attribute to control Window and its child component.


  • org.zkoss.zss.example.startzss.MyComposer.java

This class is a controller where we can write codes to control Spreadsheet e.g. listening Spreadsheet's events, or get an object of Spreadsheet. For complete explanation, please refer to ZK Developer's Reference/MVC/Controller/Composer

Prepare a Maven Project

If you want to create a Maven project, you can [http:// download our sample Maven project] to avoid creating from scratch.

If you use Compact Edition (CE) The main dependency in the sample project is org.zkoss.zss:zss:

		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zss</artifactId>
			<version>${zss.version}</version>
		</dependency>
  • ${zss.version} can be 3.0.0 or above.

If you want to use Enterprise Edition (EE), you should replace org.zkoss.zss:zss with org.zkoss.zss:zssex and add org.zkoss.zk:zkmax.

		<dependency>
			<groupId>org.zkoss.zss</groupId>
			<artifactId>zssex</artifactId>
			<version>${zss.version}</version>
		</dependency>	
		<dependency>
			<groupId>org.zkoss.zk</groupId>
			<artifactId>zkmax</artifactId>
			<version>${zk.version}</version>
		</dependency>
  • If ${zss.version} is 3.0.0 or above, ${zk.version} should be 6.5.2.

Except there is no JAR under /WEB-INF/lib, the rest are the same as dynamic web project. Please read previous paragraph about explanation of web.xml, index.zul and MyComposer.java.