0

Zeta Form Builder - interaction between UI and Controller ?

asked 2009-04-20 10:00:51 +0800

TLHP gravatar image TLHP
111 1 3

I want to understand how the MVC pattern works with Spring + Hibernate, by analyze the code generated by Zeta Form Building.

Someone can tell me which annotation were used to do the relation between UI (.zul file) and the Controller, and how it work?

Thanks in advance ...

delete flag offensive retag edit

24 Replies

Sort by » oldest newest

answered 2010-08-31 12:35:24 +0800

dandrop gravatar image dandrop
39

Hi Jimmy!

Yes, i did.

Today i tried again create a project! I did this procedure!

Install ZK Package 5.0.4 in preference in Eclipse!
Create a Zk Project called "zk5spring"
Add all jar of spring-framework-3.0.2.RELEASE-with-docs
Add a jar for zk-spring-core-bin-3.0RC
I try too add the jar of zk-spring-security-bin-3.0RC

Create file applicationContext.xml
"<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:zksp="http://www.zkoss.org/2008/zkspring"
xmlns:zksp-annot="http://www.zkoss.org/2008/zkspring-annot"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
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/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.zkoss.org/2008/zkspring
http://www.zkoss.org/2008/zkspring/zkspring.xsd
http://www.zkoss.org/2008/zkspring-annot
http://www.zkoss.org/2008/zkspring-annot/zkspring-annot.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
>


<!--
ZK Spring config

<zksp-annot:component-scan base-package="org.zkoss.spring.jpa"/>
-->
<zksp:zk-config/>

<!-- other bean definitions -->
<bean id="DataSourceTest" class="test.DataSourceImpl" />

</beans>"

Config the web.xml file.
"<!-- Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>"

I run using Apache tomcat v6.0.20 and JBoss 4.2.3.GA and the both aprear the error message

"cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'zksp:zk-config'."


Thanks for you help.

\Danilo

link publish delete flag offensive edit

answered 2010-08-31 20:03:31 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi dandrop,
Please note that since 3.0RC zkspring is split into two namespaces viz. zkspring-core and zkspring-security. To be more specific your namespace declaration in applicationContext.xml reads

xmlns:zksp="http://www.zkoss.org/2008/zkspring

which should be
xmlns:zkspc="http://www.zkoss.org/2008/zkspring/core

Also xsi:schemalocation should point to new xsd files
http://www.zkoss.org/2008/zkspring/core
       http://www.zkoss.org/2008/zkspring/core/zkspring-core.xsd

All these specifics are noted in detail on the ZKSpring docs page. If there are any more questions/problems feel free to post here.
Thanks

link publish delete flag offensive edit

answered 2010-08-31 23:11:00 +0800

robertpic71 gravatar image robertpic71
1275 1

I've just testet the annotations (@controller, scope idspace) with 5.0.4:

It works with both
5.0.4 EE and
5.0.4 Standard (requires an manuell copy from the commons-collection)

but i used the old spring version. I'll try the upgrade later.

Note: Upgrade Spring/Hibernate could be a painfull job, because there are many dependcies...
I have a working Spring 3/Hibernate 3.5.1/JPA 2.0 project, but i use ZK 3.6.3 and none of these annotations.

/Robert

link publish delete flag offensive edit

answered 2010-09-01 07:26:02 +0800

robertpic71 gravatar image robertpic71
1275 1

I've just try to upgrade an fail:

What's about xmlns:zksp-annot="http://www.zkoss.org/2008/zkspring-annot namespace?

It seems that the core contains the annotations to (scopes, appliedto) but there is no component-scan command in the core-defintion.

However i failed without the component-scan line with: (tested including and exlcuding the zkspringannot jar)

SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zkTypePropertyEditor': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.HashMap' to required type 'java.util.Map' for property 'customEditors'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.Class] to required type [java.lang.String] for property 'customEditors[class java.lang.Class]': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:643)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

The Map/Hashmap seems a Spring issue 2.x/3.x, check this side.

My Config:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zkspc="http://www.zkoss.org/2008/zkspring/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd
http://www.zkoss.org/2008/zkspring/core
http://www.zkoss.org/2008/zkspring/core/zkspring-core.xsd">

...
<zkspc:zk-config/>
...

Versions:
ZK 5.0.4 Std
Spring 3.0.3
ZKSpring 3.0RC
Config created by zeta and modified - removed old spring and zkspring jars.

The projects starts ok, when i exclude the the line <zkspc:zk-config/>.

So i think, it is not possible to run the zetaforms with spring 3.x (with the current version).

/Robert

link publish delete flag offensive edit

answered 2010-09-01 10:28:14 +0800

dandrop gravatar image dandrop
39

Hi Ashish and Jimmy,

Thanks Jimmy, I changed the file applicationContext, i had not seen this litle difference.

But now it's show the error message:

"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zkTypePropertyEditor': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.HashMap' to required type 'java.util.Map' for property 'customEditors'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.Class] to required type [java.lang.String] for property 'customEditors[class java.lang.Class]': no matching editors or conversion strategy found
...
...

"

Ashish thanks for your help too, to try solve, I did the exactly basic configuration that show in the ZKSpring, but if you add the line "<zkspc:zk-config></zkspc:zk-config>" in the applicationContext.xml it's show the error message:

"Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'zkspc:zk-config'."

Regards,
\Danilo

link publish delete flag offensive edit

answered 2010-09-07 20:50:58 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

@Robert,

> ...org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'zkTypePropertyEditor': Initialization of bean failed ...


This issue has been reported and fixed, see

http://code.google.com/p/zkspring/issues/detail?id=3&can=1

The newest freshly release shall solve it.

Regarding xmlns:zksp-annot="http://www.zkoss.org/2008/zkspring-annot. It is deprecated since ZK Spring 3.0RC. The Spring 3.x has changed package and method signature significantly and it has to be run under Java 1.5 or above. Thus ZK Spring 3.0RC has been forced to change accordingly. The function of zkspring-annot.jar shall be "merged" into zkspring-core.jar in ZK Spring 3.0RC.

@Danilo,

The ZetaForm is originally based on previous ZK Spring 1.x version. Would you post a Feature request regarding make it work with new ZK Spring 3.0RC, so we can track it. Thanks.

link publish delete flag offensive edit

answered 2010-09-09 15:37:13 +0800

dandrop gravatar image dandrop
39

Hi Henri,
I did the downlaod in this link http://www.zkoss.org/download/zkspring.dsp and the file zkspring-core.jar isn't correct.

I did the download of version zk-spring-core-bin-3.0RC-FL-2010-08-10 and it is up works, but now it show the following message:

"Cause: org.zkoss.spring.bean.ZkSpringUiFactory$ReusablePage cannot be cast to org.zkoss.zk.ui.Component
java.lang.ClassCastException: org.zkoss.spring.bean.ZkSpringUiFactory$ReusablePage cannot be cast to org.zkoss.zk.ui.Component
at org.zkoss.spring.impl.ZKProxy$1.getSelf(ZKProxy.java:132)
at org.zkoss.spring.web.context.request.IdSpaceScope.get(IdSpaceScope.java:50)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045)
at org.zkoss.spring.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:72)"

I will make more testing and when it works, I post the changing what I did.

Henri, i'm sorry, but I didn't understood what you want that i do!

Tks for your help
\Danilo

link publish delete flag offensive edit

answered 2010-09-09 20:32:40 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Danilo,

ZetaForm is an experimental feature and is based on old version of ZK (3.x), Spring (version 2.x), and ZK Spring(1.x). Unfortunately, until we get resources to handle it we cannot upgrade it to ZK 5, Spring 3.x and ZK Spring 3.0.

It is better to post this to ZK Features tracking list so we can track it.

http://sourceforge.net/tracker/?group_id=152762&atid=785194

link publish delete flag offensive edit

answered 2010-10-27 16:20:32 +0800

ovazquezv gravatar image ovazquezv
39

hi everybody

i have the same exception

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.HashMap' to required type 'java.util.Map' for property 'customEditors'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.Class] to required type [java.lang.String] for property 'customEditors[class java.lang.Class]': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 26 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.Class] to required type [java.lang.String] for property 'customEditors[class java.lang.Class]': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertToTypedMap(TypeConverterDelegate.java:606)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:178)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
... 32 more


I´m using zk-spring-core-bin-3.0RC.zip, zk-bin-5.0.4.zip, Spring 3.0.4, hibernate 3.

And i want to test using the zk-spring-core-bin-3.0RC-FL-2010-08-10 release. but i can't find the url in order to download.

Can you help me with the url or the zip, or some suggestions.

Regards

link publish delete flag offensive edit

answered 2010-10-28 10:34:50 +0800

dandrop gravatar image dandrop
39

Hi ovazquezv,

In my case! I create a Tabbox and there a controller in each Tab!

For the resolve my problem, i needed to change the logic! Instead I close the tab I change the visible for false.
and I use the session for recover the object.

I have helped you!

This is the application that i am working

http://www.jgle.com.br/actiwi/

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: 2009-04-20 10:00:51 +0800

Seen: 2,385 times

Last updated: Nov 04 '10

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