vansee / zkspring

Automatically exported from code.google.com/p/zkspring
0 stars 0 forks source link

zk + databinding + spring-web-flow may cause problem #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Re-posted from SF tracker 
https://sourceforge.net/tracker/?func=detail&aid=2566429&group_id=152762&atid=78
5191

Hello, I've tried to use zk data binding with zk + spring web flow integration,
but I got some strange exception.

the zul file is like the following

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<?variable-resolver class="org.zkoss.spring.DelegatingVariableResolver"?>

<zk:zk xmlns="http://www.zkoss.org/2005/zk/native"
xmlns:zul="http://www.zkoss.org/2005/zul"
xmlns:zk="http://www.zkoss.org/2005/zk">
<zul:window title="My First window" border="normal">
<zul:grid model="@{flowBean1.banks}">
<zul:columns>
<zul:column label="ID"/>
<zul:column label="Name"/>
</zul:columns>
<zul:rows>
<zul:row self="@{each='bank'}">
<zul:textbox value="@{bank.bankPK.noBank}"/>
<zul:textbox value="@{bank.nameBank}"/>
</zul:row>
</zul:rows>
</zul:grid>
<zul:button self="@{action(finish)}" label="Finish"/><br/>
<zul:button self="@{action(restart)}" label="Restart"/>
</zul:window>
</zk:zk>

If I click Restart or Finish button, I always get the following exception

>>java.lang.IncompatibleClassChangeError: Found interface 
org.springframework.binding.mapping.MappingResult, but class was expected
>> at 
org.zkoss.spring.webflow.execution.ZkFlowView$PropertyNotFoundError.test(ZkFlowV
iew.java:262)
>> at 
org.springframework.binding.mapping.impl.DefaultMappingResults.getResults(Defaul
tMappingResults.java:91)
>> at 
org.zkoss.spring.webflow.execution.ZkFlowView.onlyPropertyNotFoundErrorsPresent(
ZkFlowView.java:191)
>> at 
org.zkoss.spring.webflow.execution.ZkFlowView.hasMappingErrors(ZkFlowView.java:1
87)
>> at 
org.zkoss.spring.webflow.execution.ZkFlowView.processUserEvent(ZkFlowView.java:9
6)
>> at org.springframework.webflow.engine.ViewState.resume(ViewState.java:187)
>>...

However, if I remove the "grid" part, i.e., the zul file becomes:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<?variable-resolver class="org.zkoss.spring.DelegatingVariableResolver"?>

<zk:zk xmlns="http://www.zkoss.org/2005/zk/native"
xmlns:zul="http://www.zkoss.org/2005/zul"
xmlns:zk="http://www.zkoss.org/2005/zk">
<zul:window title="My First window" border="normal">
<!--zul:grid model="@{flowBean1.banks}">
<zul:columns>
<zul:column label="ID"/>
<zul:column label="Name"/>
</zul:columns>
<zul:rows>
<zul:row self="@{each='bank'}">
<zul:textbox value="@{bank.bankPK.noBank}"/>
<zul:textbox value="@{bank.nameBank}"/>
</zul:row>
</zul:rows>
</zul:grid-->
<zul:button self="@{action(finish)}" label="Finish"/><br/>
<zul:button self="@{action(restart)}" label="Restart"/>
</zul:window>
</zk:zk>

Then the exception will not happen.

So, is there conflict between zk's tranditional data binding with zk + spring 
web flow integration?

Thanks!
lendle 
4 days ago

After some further test,
it appears that the problem is caused by data binding to Collections with
"self" attribute

If remove the self attribute from <zul:row self="@{each='bank'}">,
the problem would disappear.

However, the self attribute is essential for collection binding,
I don't know if there exists any alternative for that?

Original issue reported on code.google.com by ashish.dasnurkar on 6 Apr 2011 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by ashish.dasnurkar on 6 Apr 2011 at 4:12