1

我的问题是,我尝试使用 DWR 将 TreeSet 放入我的 Javascript 中。这是我的示例代码:

Java代码:

public class myDWRObject {
  public HashMap<String, Object> getData() {
    TreeSet<aComplexObject> myTreeSet = aFunctionThatReturnsThisTreeSet();
    HashMap<String, Object> myHashMap = new HashMap<String, Object>();
    myHashMap.put("MYID", myTreeSet);
    return myHashMap
  }
}

控制器-servlet.xml:

<beans>
  <bean id="myobject" class="de.apackage.myDWRObject " scope="request">
    <dwr:remote javascript="myObject">
      <dwr:include method="getData" />
      <dwr:filter class="de.apackage.DwrControllerInitializer"/>
    </dwr:remote>
    <aop:scoped-proxy proxy-target-class="false" />
  </bean>
  <dwr:configurations>
    <dwr:create javascript="myObject" type="spring" >
      <dwr:param name="beanName" value="myobject" />
    </dwr:create>
    <dwr:convert type="object" class="java.util.TreeSet" />
    <dwr:convert type="object" class="de.apackage.aComplexObject" />
  </dwr:configurations>
</beans>

模型.xml:

<!-- {{{ CONTROLLER: myObject-->
  <controller name="myObject">

    <!-- {{{ METHOD: getData-->
    <method name="getData" type="GET|POST" session="require" transaction="false">
      <param_validator_ref idref="configspecdata"/>
      <param_validator_ref idref="ticketdata"/>

      <state value="ANY">
        <execute/>
      </state>

    </method>
    <!-- }}} -->
  </controller>
  <!-- }}} -->

在我的 HTML 文档中:

<script type="text/javascript">
  function getData () {
    myObject.getData(callBack);
  }
  function callBack(aData){
    alert("done");
  }
</script>

现在是我的问题,我从 apache 服务器得到响应:

16:50:37,17  - WARN  - [main] org.springframework.beans.factory.support.DisposableBeanAdapter - Invocation of destroy method failed on bean with name 'dwrController': java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread) 

我不明白我的错,你能帮帮我吗?有可能,dwr 不能与树集一起工作吗?

问候曼尼

4

0 回答 0