0

What is correct way to integrate ZK with Spring+Hberante. Also need a architecture diagram?

asked 2010-07-09 02:21:09 +0800

drajasuman gravatar image drajasuman
342 1

Hi,
Iam trying to use ZK as a front end - with Middle tier components as Spring with HIberante.

So, I have Some doubts - I have searched ZK site, I have not found any architectural diagram of ZK with Spring integration.

Also it is much useful if u can send me the example for One round trip end to end ZK + Spring+ Hiberante.

One more requirement- DOes Charts is supported by ZK, iS there any Library avialable for this. (For DashBoards Development).

Is there any other way of accessing spring instead of applicationCOntext?

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2010-07-09 03:10:32 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-09 03:21:56 +0800

define a spring bean:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/aop
		http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/tx
		http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">


        <!--   GUI Controllers  -->
	<bean id="customerAddressCtrl" class="de.forsthaus.webui.customer.CustomerAddressCtrl"  scope="prototype">
		<property name="customerService" ref="customerService" />
	</bean>

         .  .  .

        <!--   Backend Services/DAOs  -->
	<bean name="customerService"
		class="de.forsthaus.backend.service.impl.CustomerServiceImpl">
		<property name="customerDAO" ref="customerDAO" />
		<property name="customerAcquisitiontextDAO" ref="customerAcquisitiontextDAO" />
		<property name="customerPayconditionDAO" ref="customerPayconditionDAO" />
		<property name="customerPersontalktoDAO" ref="customerPersontalktoDAO" />
		<property name="branchDAO" ref="branchDAO" />
	</bean>

        .  .  .



get a bean:

CustomerDAO cstDAO = (CustomerDAO) org.zkoss.spring.SpringUtil.getBean("customerDAO");

let spring controll the viewController (starts in zul):

<?xml version="1.0" encoding="UTF-8" ?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>

<zk xmlns="http://www.zkoss.org/2005/zul"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">

	<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
	<!-- DataBinding Initiator.                              -->
	<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
	<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./windowCustomerAddress" ?>

	<window id="windowCustomerAddress" apply="${customerAddressCtrl}"
		border="none" width="100%">

         .  .  .


Gui Controller; extends from GenericForwardComposer

public class CustomerAddressCtrl extends GFCBaseCtrl implements Serializable {

	private static final long serialVersionUID = 1L;
	private transient static final Logger logger = Logger.getLogger(CustomerAddressCtrl.class);

	/*
	 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	 * All the components that are defined here and have a corresponding
	 * component with the same 'id' in the zul-file are getting autowired by the
	 * GenericForwardComposer.
	 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	 */
	protected Window windowCustomerAddress; // autowired
	protected Borderlayout borderLayout_customerAddress; // autowired

	protected Textbox txtb_CustomerMatchcode; // autowired
	protected Textbox txtb_CustomerCustomerNo; // autowired
       .  .  .

	protected Button btnSearchBranch; // autowired

	// Databinding
	protected transient AnnotateDataBinder binder;
	private CustomerMainCtrl customerMainCtrl;

	// ServiceDAOs / Domain Classes
	private CustomerService customerService;


	/**
	 * default constructor.<br>
	 */
	public CustomerAddressCtrl() {
		super();
	}

	@Override
	public void doAfterCompose(Component window) throws Exception {
		super.doAfterCompose(window);

		/**
		 * Set an 'alias' for this composer name in the zul file for access.<br>
		 * Set the parameter 'recurse' to 'false' to avoid problems with
		 * managing more than one zul-file in one page. Otherwise it would be
		 * overridden and can ends in curious error messages.
		 */
		if (self != null)
			self.setAttribute("controller", this, false);

	}

	// +++++++++++++++++++++++++++++++++++++++++++++++++ //
	// +++++++++++++++ Component Events ++++++++++++++++ //
	// +++++++++++++++++++++++++++++++++++++++++++++++++ //

	/**
	 * Automatically called method from zk.
	 * 
	 * @param event
	 * @throws Exception
	 */
	public void onCreate$windowCustomerAddress(Event event) throws Exception {

		if (logger.isDebugEnabled()) {
			logger.debug("--> " + event.toString());
		}

	}

	/**
	 * If the Button 'Search Branch' is clicked.<br>
	 * 
	 * @param event
	 */
	public void onClick$btnSearchBranch(Event event) {
		doSearchBranch(event);
	}

best
Stephan

link publish delete flag offensive edit

answered 2010-07-09 03:51:26 +0800

drajasuman gravatar image drajasuman
342 1

Thanks for reply.
It is much useful if u can send me architecture diagram of ZK+Spring+Hibernate. and also if u want to send the running example to my mail id - [email protected]

link publish delete flag offensive edit

answered 2010-07-09 03:56:58 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-09 03:57:20 +0800

you can checkout a bigger sample application with documentation as out of the box running eclipse projects for zk; spring; hibernate; here
Checkout from /trunk.

best
Stephan

link publish delete flag offensive edit

answered 2010-07-09 04:17:20 +0800

drajasuman gravatar image drajasuman
342 1

Hi.. Iam expecting a High Level Design diagram..Not code...

link publish delete flag offensive edit

answered 2010-07-09 06:24:37 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Sorry, i'm not a painter

link publish delete flag offensive edit

answered 2010-07-09 06:52:37 +0800

Arsen gravatar image Arsen
384 5

Have you looked here Small talks ?

link publish delete flag offensive edit

answered 2010-07-09 07:05:01 +0800

drajasuman gravatar image drajasuman
342 1

Thanks Arsen...

link publish delete flag offensive edit

answered 2010-07-09 08:13:31 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

As in your other thread: http://docs.zkoss.org/wiki/Basic_concepts#Architecture_Overview

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-07-09 02:21:09 +0800

Seen: 327 times

Last updated: Jul 09 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More