-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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?
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
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]
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
Hi.. Iam expecting a High Level Design diagram..Not code...
Sorry, i'm not a painter
Have you looked here Small talks ?
Thanks Arsen...
As in your other thread: http://docs.zkoss.org/wiki/Basic_concepts#Architecture_Overview
Asked: 2010-07-09 02:21:09 +0800
Seen: 327 times
Last updated: Jul 09 '10