简体   繁体   English

带有 DWR 的 Spring 表单控制器

[英]Spring Form Controller with DWR

I am using spring and DWR combination,When i do ajax request from DWR.I want to access entire form values bind to the bean in my DAO layer.我正在使用 spring 和 DWR 组合,当我从 DWR 执行 ajax 请求时。我想访问绑定到我 DAO 层中 bean 的整个表单值。

I didn't find any examples for Spring form controller with DWR.我没有找到带有 DWR 的 Spring 表单控制器的任何示例。

Any suggestions or help appreciated.任何建议或帮助表示赞赏。

Thanks in Advance.提前致谢。

Regards,问候,

Raj拉吉

Considering your problem is how to create Spring-DWR integration, so that you can simulate Spring controller calls from Java, try it like this:考虑到您的问题是如何创建 Spring-DWR 集成,以便您可以从 Java 模拟 Spring 控制器调用,可以这样尝试:

Your Spring XML config:您的 Spring XML 配置:

<bean id="myController" class="pkg.MyController">

    <property name="service1" ref="service1Bean"/>
    <property name="service2" ref="service2Bean"/>

    <dwr:remote javascript="MyControllerInJavascript">
        <dwr:include method="method1"/>
        <dwr:include method="method2"/>
    </dwr:remote>

</bean>

Your controller:您的控制器:

package pkg;

public class MyController {

    public SomeObject method1(String argument1, Long argument2) {
        ...
    }

    public OtherObject method2(YetAnotherObject argument1) {
        ...
    }

}

In your Javascript:在您的 Javascript 中:

<script type="text/javascript"
        src="/your_dwr_path/interface/MyControllerInJavascript.js"/>

MyControllerInJavacript.method1('argument',123,callbackMethod);

Further integration steps you can find at the docs .您可以在文档中找到进一步的集成步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM