Version Info"

From Documentation
Line 26: Line 26:
  
 
Note: For earlier ZK Spring 1.1.0 release see [[#ZK Spring 1.1.0 Release configuration details | ZK Spring 1.1.0 Release configuration details]] for copying spring.jar
 
Note: For earlier ZK Spring 1.1.0 release see [[#ZK Spring 1.1.0 Release configuration details | ZK Spring 1.1.0 Release configuration details]] for copying spring.jar
 
=== Configure web.xml ===
 
In your web.xml, you have to define <tt>org.springframework.web.context.ContextLoaderListener</tt>, and to specify the location of the configuration file to load bean definitions.
 
 
<source lang="xml" >
 
<context-param>
 
  <param-name>contextConfigLocation</param-name>
 
  <param-value>/WEB-INF/applicationContext.xml</param-value>
 
</context-param>
 
 
<listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 
</listener>
 
</source>
 
 
=== Create Spring Configuration File ===
 
Define bean definitions in <tt>applicationContext.xml</tt> file, and put it into your <tt>WEB-INF</tt> directory.
 
 
<source lang="xml" >
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
 
<beans>
 
  <bean id="DataSource" class="test.DataSourceImpl"/>
 
</beans>
 
</source>
 
 
=== Creating Spring Bean Class ===
 
For OOP programming, you have to define a DataSource interface:
 
 
<tt>''DataSource.java''</tt>
 
 
<source lang="java" >
 
package test;
 
 
public interface DataSource
 
{
 
  java.util.List getElementsList();
 
}
 
</source>
 
 
and its implementation:
 
 
<tt>''DataSourceImpl.java''</tt>
 
 
<source lang="java" >
 
package test;
 
 
import java.util.*;
 
 
public class DataSourceImpl implements DataSource
 
{
 
  public List getElementsList()
 
  {
 
        List list = new ArrayList();
 
        list.add("Tom");
 
        list.add("Henri");
 
        list.add("Jim");
 
       
 
        return list;
 
  }
 
}
 
</source>
 
  
 
{{ ZKDevelopersGuidePageFooter}}
 
{{ ZKDevelopersGuidePageFooter}}

Revision as of 01:47, 18 November 2010

Stop.png This documentation is for an older version of ZK. For the latest one, please click here.



ZK Spring integrations 3.0RC has been tested to work with with ZK 5.0.1, Spring core 3.0.2 and Spring Security 3.0.2 releases.

Copy Spring binaries into your Web library

Before using Spring, you have to download it, and put the jar file into the directory of your web application.

  1. Download Spring Core framework 3.0.2 release binaries download
  2. Since 3.0.x release Spring is distributed as a collection fo Spring module jar files instead of a single spring.jar. You need following Spring module jar files on your class-path for using zkspring-core.jar of ZK Spring 3.0RC release.
    • org.springframework.aop-3.0.2.RELEASE.jar
    • org.springframework.asm-3.0.2.RELEASE.jar
    • org.springframework.beans-3.0.2.RELEASE.jar
    • org.springframework.context-3.0.2.RELEASE.jar
    • org.springframework.context.support-3.0.2.RELEASE.jar
    • org.springframework.core-3.0.2.RELEASE.jar
    • org.springframework.expression-3.0.2.RELEASE.jar
    • org.springframework.transaction-3.0.2.RELEASE.jar
    • org.springframework.web-3.0.2.RELEASE.jar
    • org.springframework.web.servlet-3.0.2.RELEASE.jar

Put these jar files into your $myApp/WEB-INF/lib/

Here $myApp represents the name of your web application.

Note: For earlier ZK Spring 1.1.0 release see ZK Spring 1.1.0 Release configuration details for copying spring.jar



Last Update : 2010/11/18

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