Uploaded image for project: 'ZK Spring'
  1. ZK Spring
  2. ZKSPRING-9

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.1
    • None
    • None
    • None

      copied from http://code.google.com/p/zkspring/issues/detail?id=17


      Re-posted from SF tracker https://sourceforge.net/tracker/?func=detail&aid=2566429&group_id=152762&atid=785191
      (Submitted: Lendle Tseng ( lendle ) - 2009-02-04 18:51:18 PST)

      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(ZkFlowView.java:262)
      >> at org.springframework.binding.mapping.impl.DefaultMappingResults.getResults(DefaultMappingResults.java:91)
      >> at org.zkoss.spring.webflow.execution.ZkFlowView.onlyPropertyNotFoundErrorsPresent(ZkFlowView.java:191)
      >> at org.zkoss.spring.webflow.execution.ZkFlowView.hasMappingErrors(ZkFlowView.java:187)
      >> at org.zkoss.spring.webflow.execution.ZkFlowView.processUserEvent(ZkFlowView.java:96)
      >> 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?

            hawk hawk
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: